diff --git a/doc/snippets/MagnumVk.cpp b/doc/snippets/MagnumVk.cpp index 8d90b1047..11b64b578 100644 --- a/doc/snippets/MagnumVk.cpp +++ b/doc/snippets/MagnumVk.cpp @@ -40,6 +40,7 @@ #include "Magnum/Vk/CommandPoolCreateInfo.h" #include "Magnum/Vk/ComputePipelineCreateInfo.h" #include "Magnum/Vk/DescriptorSetLayoutCreateInfo.h" +#include "Magnum/Vk/DescriptorType.h" #include "Magnum/Vk/DeviceCreateInfo.h" #include "Magnum/Vk/DeviceFeatures.h" #include "Magnum/Vk/DeviceProperties.h" diff --git a/src/Magnum/Vk/CMakeLists.txt b/src/Magnum/Vk/CMakeLists.txt index fcebd1574..5335d956b 100644 --- a/src/Magnum/Vk/CMakeLists.txt +++ b/src/Magnum/Vk/CMakeLists.txt @@ -75,6 +75,7 @@ set(MagnumVk_HEADERS ComputePipelineCreateInfo.h DescriptorSetLayout.h DescriptorSetLayoutCreateInfo.h + DescriptorType.h Device.h DeviceCreateInfo.h DeviceFeatures.h diff --git a/src/Magnum/Vk/DescriptorSetLayoutCreateInfo.h b/src/Magnum/Vk/DescriptorSetLayoutCreateInfo.h index b1193db43..932098d0e 100644 --- a/src/Magnum/Vk/DescriptorSetLayoutCreateInfo.h +++ b/src/Magnum/Vk/DescriptorSetLayoutCreateInfo.h @@ -26,7 +26,7 @@ */ /** @file - * @brief Class @ref Magnum::Vk::DescriptorSetLayoutCreateInfo, @ref Magnum::Vk::DescriptorSetLayoutBinding, enum @ref Magnum::Vk::DescriptorType + * @brief Class @ref Magnum::Vk::DescriptorSetLayoutCreateInfo, @ref Magnum::Vk::DescriptorSetLayoutBinding * @m_since_latest */ @@ -48,120 +48,6 @@ namespace Magnum { namespace Vk { -/** -@brief Descriptor type -@m_since_latest - -Wraps @type_vk_keyword{DescriptorType}. -@see @ref DescriptorSetLayoutBinding -@m_enum_values_as_keywords -*/ -enum class DescriptorType: Int { - /** - * @ref Sampler. - * - * @see @ref DescriptorType::CombinedImageSampler - */ - Sampler = VK_DESCRIPTOR_TYPE_SAMPLER, - - /** - * @ref Sampler combined with an @ref Image. - * - * @m_class{m-note m-success} - * - * @par - * On some implementations it may be more efficient to sample from an - * a combined image sampler than a separate - * @ref DescriptorType::Sampler and @ref DescriptorType::SampledImage. - * - * The image is expected to have been created with @ref ImageUsage::Sampled - * and be in either @ref ImageLayout::General or - * @ref ImageLayout::ShaderReadOnly. - */ - CombinedImageSampler = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, - - /** - * Sampled @ref Image. - * - * The image is expected to have been created with @ref ImageUsage::Sampled - * and be in either @ref ImageLayout::General or - * @ref ImageLayout::ShaderReadOnly. - * @see @ref DescriptorType::CombinedImageSampler - */ - SampledImage = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, - - /** - * Storage @ref Image. - * - * The image is expected to have been created with @ref ImageUsage::Storage - * and be in @ref ImageLayout::General. - */ - StorageImage = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - - /** - * Uniform texel buffer view. - * - * The buffer is expected to have been created with - * @ref BufferUsage::UniformTexelBuffer. - */ - UniformTexelBuffer = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, - - /** - * Storage texel buffer view. - * - * The buffer is expected to have been created with - * @ref BufferUsage::StorageTexelBuffer. - */ - StorageTexelBuffer = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, - - /** - * Uniform @ref Buffer. - * - * The buffer is expected to have been created with - * @ref BufferUsage::UniformBuffer. - */ - UniformBuffer = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, - - /** - * Storage @ref Buffer. - * - * The buffer is expected to have been created with - * @ref BufferUsage::StorageBuffer. - */ - StorageBuffer = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, - - /** - * Uniform @ref Buffer with a dynamic offset. - * - * The buffer is expected to have been created with - * @ref BufferUsage::UniformBuffer. - */ - UniformBufferDynamic = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, - - /** - * Storage @ref Buffer with a dynamic offset. - * - * The buffer is expected to have been created with - * @ref BufferUsage::StorageBuffer. - */ - StorageBufferDynamic = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, - - /** - * Input @ref Image attachment. - * - * The image is expected to have been created with - * @ref ImageUsage::InputAttachment and be in @ref ImageLayout::General. - */ - InputAttachment = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, - - /** - * Acceleration structure. - * - * @requires_vk_feature @ref DeviceFeature::AccelerationStructure - */ - AccelerationStructure = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR -}; - /** @brief Descriptor set layout binding @m_since_latest diff --git a/src/Magnum/Vk/DescriptorType.h b/src/Magnum/Vk/DescriptorType.h new file mode 100644 index 000000000..9022eff01 --- /dev/null +++ b/src/Magnum/Vk/DescriptorType.h @@ -0,0 +1,154 @@ +#ifndef Magnum_Vk_DescriptorType_h +#define Magnum_Vk_DescriptorType_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, + 2020, 2021 Vladimír Vondruš + + 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 Enum @ref Magnum::Vk::DescriptorType + * @m_since_latest + */ + +#include "Magnum/Vk/Vk.h" +#include "Magnum/Vk/Vulkan.h" + +namespace Magnum { namespace Vk { + +/** +@brief Descriptor type +@m_since_latest + +Wraps @type_vk_keyword{DescriptorType}. +@see @ref DescriptorSetLayoutBinding +@m_enum_values_as_keywords +*/ +enum class DescriptorType: Int { + /** + * @ref Sampler. + * + * @see @ref DescriptorType::CombinedImageSampler + */ + Sampler = VK_DESCRIPTOR_TYPE_SAMPLER, + + /** + * @ref Sampler combined with an @ref Image. + * + * @m_class{m-note m-success} + * + * @par + * On some implementations it may be more efficient to sample from an + * a combined image sampler than a separate + * @ref DescriptorType::Sampler and @ref DescriptorType::SampledImage. + * + * The image is expected to have been created with @ref ImageUsage::Sampled + * and be in either @ref ImageLayout::General or + * @ref ImageLayout::ShaderReadOnly. + */ + CombinedImageSampler = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, + + /** + * Sampled @ref Image. + * + * The image is expected to have been created with @ref ImageUsage::Sampled + * and be in either @ref ImageLayout::General or + * @ref ImageLayout::ShaderReadOnly. + * @see @ref DescriptorType::CombinedImageSampler + */ + SampledImage = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, + + /** + * Storage @ref Image. + * + * The image is expected to have been created with @ref ImageUsage::Storage + * and be in @ref ImageLayout::General. + */ + StorageImage = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, + + /** + * Uniform texel buffer view. + * + * The buffer is expected to have been created with + * @ref BufferUsage::UniformTexelBuffer. + */ + UniformTexelBuffer = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, + + /** + * Storage texel buffer view. + * + * The buffer is expected to have been created with + * @ref BufferUsage::StorageTexelBuffer. + */ + StorageTexelBuffer = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, + + /** + * Uniform @ref Buffer. + * + * The buffer is expected to have been created with + * @ref BufferUsage::UniformBuffer. + */ + UniformBuffer = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, + + /** + * Storage @ref Buffer. + * + * The buffer is expected to have been created with + * @ref BufferUsage::StorageBuffer. + */ + StorageBuffer = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, + + /** + * Uniform @ref Buffer with a dynamic offset. + * + * The buffer is expected to have been created with + * @ref BufferUsage::UniformBuffer. + */ + UniformBufferDynamic = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, + + /** + * Storage @ref Buffer with a dynamic offset. + * + * The buffer is expected to have been created with + * @ref BufferUsage::StorageBuffer. + */ + StorageBufferDynamic = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, + + /** + * Input @ref Image attachment. + * + * The image is expected to have been created with + * @ref ImageUsage::InputAttachment and be in @ref ImageLayout::General. + */ + InputAttachment = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, + + /** + * Acceleration structure. + * + * @requires_vk_feature @ref DeviceFeature::AccelerationStructure + */ + AccelerationStructure = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR +}; + +}} + +#endif diff --git a/src/Magnum/Vk/Test/DescriptorSetLayoutTest.cpp b/src/Magnum/Vk/Test/DescriptorSetLayoutTest.cpp index 750d41128..db9aa3af9 100644 --- a/src/Magnum/Vk/Test/DescriptorSetLayoutTest.cpp +++ b/src/Magnum/Vk/Test/DescriptorSetLayoutTest.cpp @@ -27,6 +27,7 @@ #include #include "Magnum/Vk/DescriptorSetLayoutCreateInfo.h" +#include "Magnum/Vk/DescriptorType.h" #include "Magnum/Vk/Shader.h" namespace Magnum { namespace Vk { namespace Test { namespace { diff --git a/src/Magnum/Vk/Test/DescriptorSetLayoutVkTest.cpp b/src/Magnum/Vk/Test/DescriptorSetLayoutVkTest.cpp index ca463eccc..7a6f2e4d6 100644 --- a/src/Magnum/Vk/Test/DescriptorSetLayoutVkTest.cpp +++ b/src/Magnum/Vk/Test/DescriptorSetLayoutVkTest.cpp @@ -26,6 +26,7 @@ #include #include "Magnum/Vk/DescriptorSetLayoutCreateInfo.h" +#include "Magnum/Vk/DescriptorType.h" #include "Magnum/Vk/Result.h" #include "Magnum/Vk/VulkanTester.h" diff --git a/src/Magnum/Vk/Test/PipelineLayoutVkTest.cpp b/src/Magnum/Vk/Test/PipelineLayoutVkTest.cpp index e9869929f..949fb4f47 100644 --- a/src/Magnum/Vk/Test/PipelineLayoutVkTest.cpp +++ b/src/Magnum/Vk/Test/PipelineLayoutVkTest.cpp @@ -26,6 +26,7 @@ #include #include "Magnum/Vk/DescriptorSetLayoutCreateInfo.h" +#include "Magnum/Vk/DescriptorType.h" #include "Magnum/Vk/PipelineLayoutCreateInfo.h" #include "Magnum/Vk/Result.h" #include "Magnum/Vk/VulkanTester.h"