diff --git a/include/vkcv/FeatureManager.hpp b/include/vkcv/FeatureManager.hpp index f2138f6f3b7c5f639d42e98a83991704df0eb352..4a6be3179cfbdca1042cfd5cc4b218429d2a53b1 100644 --- a/include/vkcv/FeatureManager.hpp +++ b/include/vkcv/FeatureManager.hpp @@ -334,6 +334,17 @@ namespace vkcv { */ [[nodiscard]] bool checkSupport(const vk::PhysicalDeviceIndexTypeUint8FeaturesEXT &features, bool required) const; + + /** + * @brief Checks support of the @p vk::PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT. + * + * @param[in] features The features + * @param[in] required True, if the @p features are required, else false + * @return @p True, if the @p features are supported, else @p false + */ + [[nodiscard]] bool + FeatureManager::checkSupport(const vk::PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT &features, + bool required) const; /** * @brief Searches for a base structure of a given structure type. diff --git a/src/vkcv/BufferManager.cpp b/src/vkcv/BufferManager.cpp index 567041bb602493196512b554014cf39277926bdc..62a2f86d70bbcc2b2cd22c36e2b421aa2413b2bc 100644 --- a/src/vkcv/BufferManager.cpp +++ b/src/vkcv/BufferManager.cpp @@ -14,8 +14,13 @@ namespace vkcv { return false; } - m_stagingBuffer = createBuffer(TypeGuard(1), BufferType::STAGING, - BufferMemoryType::HOST_VISIBLE, 1024 * 1024, false); + m_stagingBuffer = createBuffer( + TypeGuard(1), + BufferType::STAGING, + BufferMemoryType::HOST_VISIBLE, + 1024 * 1024, + false + ); return true; } @@ -119,13 +124,29 @@ namespace vkcv { auto bufferAllocation = allocator.createBuffer( vk::BufferCreateInfo(createFlags, size, usageFlags), - vma::AllocationCreateInfo(vma::AllocationCreateFlags(), memoryUsage, memoryTypeFlags, - memoryTypeFlags, 0, vma::Pool(), nullptr)); + vma::AllocationCreateInfo( + vma::AllocationCreateFlags(), + memoryUsage, + memoryTypeFlags, + memoryTypeFlags, + 0, + vma::Pool(), + nullptr + ) + ); vk::Buffer buffer = bufferAllocation.first; vma::Allocation allocation = bufferAllocation.second; - return add({ typeGuard, type, memoryType, size, buffer, allocation, mappable }); + return add({ + typeGuard, + type, + memoryType, + size, + buffer, + allocation, + mappable + }); } /** diff --git a/src/vkcv/FeatureManager.cpp b/src/vkcv/FeatureManager.cpp index bc9640c781c33abfb0ac7dee915696ce563bbc0a..503bfa5908d83c4507e64cbd6f32306150ffeb68 100644 --- a/src/vkcv/FeatureManager.cpp +++ b/src/vkcv/FeatureManager.cpp @@ -485,6 +485,15 @@ namespace vkcv { return true; } + + bool FeatureManager::checkSupport(const vk::PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT &features, + bool required) const { + vkcv_check_init_features2(vk::PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT); + + vkcv_check_feature(pageableDeviceLocalMemory); + + return true; + } vk::BaseOutStructure* FeatureManager::findFeatureStructure(vk::StructureType type) const { for (auto &base : m_featuresExtensions) { diff --git a/src/vkcv/ImageManager.cpp b/src/vkcv/ImageManager.cpp index 993243cb5644dd3a1527f3c50efadc9fdc9aa299..d65f58817df6d28948479667e1daafc757f7d0df 100644 --- a/src/vkcv/ImageManager.cpp +++ b/src/vkcv/ImageManager.cpp @@ -96,10 +96,17 @@ namespace vkcv { vk::ImageSubresourceLayers(aspectMask, srcMip, 0, 1), { vk::Offset3D(0, 0, 0), vk::Offset3D(srcWidth, srcHeight, srcDepth) }, vk::ImageSubresourceLayers(aspectMask, dstMip, 0, 1), - { vk::Offset3D(0, 0, 0), vk::Offset3D(dstWidth, dstHeight, dstDepth) }); - - cmdBuffer.blitImage(image.m_handle, vk::ImageLayout::eGeneral, image.m_handle, - vk::ImageLayout::eGeneral, region, vk::Filter::eLinear); + { vk::Offset3D(0, 0, 0), vk::Offset3D(dstWidth, dstHeight, dstDepth) } + ); + + cmdBuffer.blitImage( + image.m_handle, + vk::ImageLayout::eGeneral, + image.m_handle, + vk::ImageLayout::eGeneral, + region, + vk::Filter::eLinear + ); srcWidth = dstWidth; srcHeight = dstHeight; @@ -234,10 +241,16 @@ namespace vkcv { auto imageAllocation = allocator.createImage( imageCreateInfo, - vma::AllocationCreateInfo(vma::AllocationCreateFlags(), vma::MemoryUsage::eGpuOnly, - vk::MemoryPropertyFlagBits::eDeviceLocal, - vk::MemoryPropertyFlagBits::eDeviceLocal, 0, vma::Pool(), - nullptr)); + vma::AllocationCreateInfo( + vma::AllocationCreateFlags(), + vma::MemoryUsage::eGpuOnly, + vk::MemoryPropertyFlagBits::eDeviceLocal, + vk::MemoryPropertyFlagBits::eDeviceLocal, + 0, + vma::Pool(), + nullptr + ) + ); vk::Image image = imageAllocation.first; vma::Allocation allocation = imageAllocation.second; @@ -259,9 +272,19 @@ namespace vkcv { const vk::ImageViewCreateInfo imageViewCreateInfo( {}, image, imageViewType, format, vk::ComponentMapping( - vk::ComponentSwizzle::eIdentity, vk::ComponentSwizzle::eIdentity, - vk::ComponentSwizzle::eIdentity, vk::ComponentSwizzle::eIdentity), - vk::ImageSubresourceRange(aspectFlags, mip, mipCount - mip, 0, arrayLayers)); + vk::ComponentSwizzle::eIdentity, + vk::ComponentSwizzle::eIdentity, + vk::ComponentSwizzle::eIdentity, + vk::ComponentSwizzle::eIdentity + ), + vk::ImageSubresourceRange( + aspectFlags, + mip, + mipCount - mip, + 0, + arrayLayers + ) + ); views.push_back(device.createImageView(imageViewCreateInfo)); } @@ -270,20 +293,36 @@ namespace vkcv { const vk::ImageViewCreateInfo imageViewCreateInfo( {}, image, vk::ImageViewType::e2DArray, format, vk::ComponentMapping( - vk::ComponentSwizzle::eIdentity, vk::ComponentSwizzle::eIdentity, - vk::ComponentSwizzle::eIdentity, vk::ComponentSwizzle::eIdentity), - vk::ImageSubresourceRange(aspectFlags, mip, 1, 0, arrayLayers)); + vk::ComponentSwizzle::eIdentity, + vk::ComponentSwizzle::eIdentity, + vk::ComponentSwizzle::eIdentity, + vk::ComponentSwizzle::eIdentity + ), + vk::ImageSubresourceRange( + aspectFlags, + mip, + 1, + 0, + arrayLayers + ) + ); arrayViews.push_back(device.createImageView(imageViewCreateInfo)); } - return add({ image, allocation, - - views, arrayViews, - - width, height, depth, - - format, arrayLayers, vk::ImageLayout::eUndefined, supportStorage }); + return add({ + image, + allocation, + views, + arrayViews, + width, + height, + depth, + format, + arrayLayers, + vk::ImageLayout::eUndefined, + supportStorage + }); } ImageHandle ImageManager::createSwapchainImage() const {