diff --git a/doc/changelog.dox b/doc/changelog.dox index 81508c735..77e50b35c 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -1304,10 +1304,14 @@ See also: @ref GL::Buffer::setLabel() "setLabel()" APIs now work with a @relativeref{Corrade,Containers::StringView} / @relativeref{Corrade,Containers::String} instead of a @ref std::string + - @ref Vk::DescriptorPoolCreateInfo and @ref Vk::AttachmentDescription + APIs now take a @relativeref{Corrade,Containers::Pair} instead of a + @ref std::pair To handle most backwards compatibility, @ref Corrade/Containers/StringStl.h - is included in affected headers for implicit conversions from/to a - @ref std::string, but in some cases you may be forced to change the code - that uses those APIs. + and/or @ref Corrade/Containers/PairStl.h is included in affected headers + for implicit conversions from/to a @ref std::string and/or @ref std::pair, + but in some cases you may be forced to change the code that uses those + APIs. - @ref Image, @ref ImageView and @ref Trade::ImageData now look for a @cpp pixelFormatSize() @ce API via ADL instead of @cpp pixelSize() @ce. In case you were passing a custom pixel format enum to the image classes, you diff --git a/src/Magnum/Vk/DescriptorPool.cpp b/src/Magnum/Vk/DescriptorPool.cpp index c949d706d..56896a9a9 100644 --- a/src/Magnum/Vk/DescriptorPool.cpp +++ b/src/Magnum/Vk/DescriptorPool.cpp @@ -38,7 +38,7 @@ namespace Magnum { namespace Vk { -DescriptorPoolCreateInfo::DescriptorPoolCreateInfo(const UnsignedInt maxSets, const Containers::ArrayView> poolSizes, const Flags flags): _info{} { +DescriptorPoolCreateInfo::DescriptorPoolCreateInfo(const UnsignedInt maxSets, const Containers::ArrayView> poolSizes, const Flags flags): _info{} { CORRADE_ASSERT(maxSets, "Vk::DescriptorPoolCreateInfo: there has to be at least one set", ); /* On certain compilers, {} (empty initializer list) gets converted to an @@ -52,10 +52,10 @@ DescriptorPoolCreateInfo::DescriptorPoolCreateInfo(const UnsignedInt maxSets, co {NoInit, poolSizes.size(), poolSizesCopy} }; for(std::size_t i = 0; i != poolSizes.size(); ++i) { - CORRADE_ASSERT(poolSizes[i].second, - "Vk::DescriptorPoolCreateInfo: pool" << i << "of" << poolSizes[i].first << "has no descriptors", ); - poolSizesCopy[i].type = VkDescriptorType(poolSizes[i].first); - poolSizesCopy[i].descriptorCount = poolSizes[i].second; + CORRADE_ASSERT(poolSizes[i].second(), + "Vk::DescriptorPoolCreateInfo: pool" << i << "of" << poolSizes[i].first() << "has no descriptors", ); + poolSizesCopy[i].type = VkDescriptorType(poolSizes[i].first()); + poolSizesCopy[i].descriptorCount = poolSizes[i].second(); } _info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; @@ -65,7 +65,7 @@ DescriptorPoolCreateInfo::DescriptorPoolCreateInfo(const UnsignedInt maxSets, co _info.pPoolSizes = poolSizesCopy; } -DescriptorPoolCreateInfo::DescriptorPoolCreateInfo(const UnsignedInt maxSets, const std::initializer_list> poolSizes, const Flags flags): DescriptorPoolCreateInfo{maxSets, Containers::arrayView(poolSizes), flags} {} +DescriptorPoolCreateInfo::DescriptorPoolCreateInfo(const UnsignedInt maxSets, const std::initializer_list> poolSizes, const Flags flags): DescriptorPoolCreateInfo{maxSets, Containers::arrayView(poolSizes), flags} {} DescriptorPoolCreateInfo::DescriptorPoolCreateInfo(NoInitT) noexcept {} diff --git a/src/Magnum/Vk/DescriptorPoolCreateInfo.h b/src/Magnum/Vk/DescriptorPoolCreateInfo.h index 6273e243a..1ccc17386 100644 --- a/src/Magnum/Vk/DescriptorPoolCreateInfo.h +++ b/src/Magnum/Vk/DescriptorPoolCreateInfo.h @@ -30,7 +30,6 @@ * @m_since_latest */ -#include #include #include @@ -40,6 +39,11 @@ #include "Magnum/Vk/Vk.h" #include "Magnum/Vk/Vulkan.h" +#ifdef MAGNUM_BUILD_DEPRECATED +/* DescriptorPoolCreateInfo constructors used to take a std::pair */ +#include +#endif + namespace Magnum { namespace Vk { /** @@ -126,9 +130,9 @@ class MAGNUM_VK_EXPORT DescriptorPoolCreateInfo { * - `poolSizeCount` and `pPoolSizes` to @p poolSizes converted to * a list of @type_vk{DescriptorPoolSize} structures */ - explicit DescriptorPoolCreateInfo(UnsignedInt maxSets, Containers::ArrayView> poolSizes, Flags flags = {}); + explicit DescriptorPoolCreateInfo(UnsignedInt maxSets, Containers::ArrayView> poolSizes, Flags flags = {}); /** @overload */ - explicit DescriptorPoolCreateInfo(UnsignedInt maxSets, std::initializer_list> poolSizes, Flags flags = {}); + explicit DescriptorPoolCreateInfo(UnsignedInt maxSets, std::initializer_list> poolSizes, Flags flags = {}); /** * @brief Construct without initializing the contents diff --git a/src/Magnum/Vk/RenderPass.cpp b/src/Magnum/Vk/RenderPass.cpp index 945eb4c4e..4028cb48e 100644 --- a/src/Magnum/Vk/RenderPass.cpp +++ b/src/Magnum/Vk/RenderPass.cpp @@ -59,22 +59,22 @@ AttachmentDescription::AttachmentDescription(const Magnum::PixelFormat format, c AttachmentDescription::AttachmentDescription(const Magnum::CompressedPixelFormat format, const AttachmentLoadOperation loadOperation, const AttachmentStoreOperation storeOperation, const ImageLayout initialLayout, const ImageLayout finalLayout, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), loadOperation, storeOperation, initialLayout, finalLayout, samples, flags} {} -AttachmentDescription::AttachmentDescription(const PixelFormat format, const std::pair depthStencilLoadOperation, const std::pair depthStencilStoreOperation, const ImageLayout initialLayout, const ImageLayout finalLayout, const Int samples, const Flags flags): _description{} { +AttachmentDescription::AttachmentDescription(const PixelFormat format, const Containers::Pair depthStencilLoadOperation, const Containers::Pair depthStencilStoreOperation, const ImageLayout initialLayout, const ImageLayout finalLayout, const Int samples, const Flags flags): _description{} { _description.sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2; _description.flags = VkAttachmentDescriptionFlags(flags); _description.format = VkFormat(format); _description.samples = VkSampleCountFlagBits(samples); - _description.loadOp = VkAttachmentLoadOp(depthStencilLoadOperation.first); - _description.storeOp = VkAttachmentStoreOp(depthStencilStoreOperation.first); - _description.stencilLoadOp = VkAttachmentLoadOp(depthStencilLoadOperation.second); - _description.stencilStoreOp = VkAttachmentStoreOp(depthStencilStoreOperation.second); + _description.loadOp = VkAttachmentLoadOp(depthStencilLoadOperation.first()); + _description.storeOp = VkAttachmentStoreOp(depthStencilStoreOperation.first()); + _description.stencilLoadOp = VkAttachmentLoadOp(depthStencilLoadOperation.second()); + _description.stencilStoreOp = VkAttachmentStoreOp(depthStencilStoreOperation.second()); _description.initialLayout = VkImageLayout(initialLayout); _description.finalLayout = VkImageLayout(finalLayout); } -AttachmentDescription::AttachmentDescription(const Magnum::PixelFormat format, const std::pair depthStencilLoadOperation, const std::pair depthStencilStoreOperation, const ImageLayout initialLayout, const ImageLayout finalLayout, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), depthStencilLoadOperation, depthStencilStoreOperation, initialLayout, finalLayout, samples, flags} {} +AttachmentDescription::AttachmentDescription(const Magnum::PixelFormat format, const Containers::Pair depthStencilLoadOperation, const Containers::Pair depthStencilStoreOperation, const ImageLayout initialLayout, const ImageLayout finalLayout, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), depthStencilLoadOperation, depthStencilStoreOperation, initialLayout, finalLayout, samples, flags} {} -AttachmentDescription::AttachmentDescription(const Magnum::CompressedPixelFormat format, const std::pair depthStencilLoadOperation, const std::pair depthStencilStoreOperation, const ImageLayout initialLayout, const ImageLayout finalLayout, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), depthStencilLoadOperation, depthStencilStoreOperation, initialLayout, finalLayout, samples, flags} {} +AttachmentDescription::AttachmentDescription(const Magnum::CompressedPixelFormat format, const Containers::Pair depthStencilLoadOperation, const Containers::Pair depthStencilStoreOperation, const ImageLayout initialLayout, const ImageLayout finalLayout, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), depthStencilLoadOperation, depthStencilStoreOperation, initialLayout, finalLayout, samples, flags} {} AttachmentDescription::AttachmentDescription(NoInitT) noexcept {} diff --git a/src/Magnum/Vk/RenderPassCreateInfo.h b/src/Magnum/Vk/RenderPassCreateInfo.h index fda26f9d6..a667f896f 100644 --- a/src/Magnum/Vk/RenderPassCreateInfo.h +++ b/src/Magnum/Vk/RenderPassCreateInfo.h @@ -30,7 +30,6 @@ * @m_since_latest */ -#include #include #include @@ -40,6 +39,11 @@ #include "Magnum/Vk/Vulkan.h" #include "Magnum/Vk/visibility.h" +#ifdef MAGNUM_BUILD_DEPRECATED +/* AttachmentDescription constructors used to take a std::pair */ +#include +#endif + namespace Magnum { namespace Vk { /** @@ -201,7 +205,7 @@ class MAGNUM_VK_EXPORT AttachmentDescription { * - `initialLayout` * - `finalLayout` * - * See also @ref AttachmentDescription(PixelFormat, std::pair, std::pair, ImageLayout, ImageLayout, Int, Flags) + * See also @ref AttachmentDescription(PixelFormat, Containers::Pair, Containers::Pair, ImageLayout, ImageLayout, Int, Flags) * for a constructing a combined depth/stencil attachment description. */ /* These were implicit at first, but I realized code gets way too @@ -250,11 +254,11 @@ class MAGNUM_VK_EXPORT AttachmentDescription { */ /* These were implicit at first, but I realized code gets way too confusing with all the {{}} so it's not anymore */ - explicit AttachmentDescription(PixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + explicit AttachmentDescription(PixelFormat format, Containers::Pair depthStencilLoadOperation, Containers::Pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); /** @overload */ - explicit AttachmentDescription(Magnum::PixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + explicit AttachmentDescription(Magnum::PixelFormat format, Containers::Pair depthStencilLoadOperation, Containers::Pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); /** @overload */ - explicit AttachmentDescription(Magnum::CompressedPixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + explicit AttachmentDescription(Magnum::CompressedPixelFormat format, Containers::Pair depthStencilLoadOperation, Containers::Pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); /** * @brief Construct without initializing the contents