diff --git a/doc/changelog.dox b/doc/changelog.dox index f12be3090..edf77d99e 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -342,6 +342,17 @@ See also: @ref MAGNUM_BUILD_DEPRECATED is enabled, the returned type acts as a @ref Corrade::Containers::Optional but has (deprecated) implicit conversion to a @ref Corrade::Containers::Pointer to avoid breaking user code. +- @cpp Vk::hasVkFormat(Magnum::PixelFormat) @ce, + @cpp Vk::hasVkFormat(Magnum::CompressedPixelFormat) @ce, + @cpp Vk::vkFormat(Magnum::PixelFormat) @ce and + @cpp Vk::vkFormat(Magnum::CompressedPixelFormat) @ce returning a raw + @type_vk{Format} are deprecated in favor of + @ref Vk::hasPixelFormat(Magnum::PixelFormat), + @ref Vk::hasPixelFormat(Magnum::CompressedPixelFormat), + @ref Vk::pixelFormat(Magnum::PixelFormat) and + @ref Vk::pixelFormat(Magnum::CompressedPixelFormat) that return the new + @ref Vk::PixelFormat enum that contains only values suitable for a pixel + format @subsection changelog-latest-compatibility Potential compatibility breakages, removed APIs diff --git a/doc/snippets/MagnumVk.cpp b/doc/snippets/MagnumVk.cpp index 394aa87e5..4c9c839a3 100644 --- a/doc/snippets/MagnumVk.cpp +++ b/doc/snippets/MagnumVk.cpp @@ -29,6 +29,7 @@ #include #include "Magnum/Magnum.h" +#include "Magnum/PixelFormat.h" #include "Magnum/Math/Color.h" #include "Magnum/Vk/Assert.h" #include "Magnum/Vk/BufferCreateInfo.h" @@ -47,6 +48,7 @@ #include "Magnum/Vk/ImageViewCreateInfo.h" #include "Magnum/Vk/LayerProperties.h" #include "Magnum/Vk/MemoryAllocateInfo.h" +#include "Magnum/Vk/PixelFormat.h" #include "Magnum/Vk/Queue.h" #include "Magnum/Vk/RenderPassCreateInfo.h" #include "Magnum/Vk/Result.h" @@ -392,10 +394,10 @@ DOXYGEN_IGNORE() Vk::Image color{device, Vk::ImageCreateInfo2D{ /* created before */ Vk::ImageUsage::ColorAttachment, - VK_FORMAT_R8G8B8A8_UNORM, size, 1}, DOXYGEN_IGNORE(NoAllocate)}; + Vk::PixelFormat::RGBA8Unorm, size, 1}, DOXYGEN_IGNORE(NoAllocate)}; Vk::Image depth{device, Vk::ImageCreateInfo2D{ Vk::ImageUsage::DepthStencilAttachment, - VK_FORMAT_D24_UNORM_S8_UINT, size, 1}, DOXYGEN_IGNORE(NoAllocate)}; + Vk::PixelFormat::Depth24UnormStencil8UI, size, 1}, DOXYGEN_IGNORE(NoAllocate)}; Vk::ImageView colorView{device, Vk::ImageViewCreateInfo2D{color}}; Vk::ImageView depthView{device, Vk::ImageViewCreateInfo2D{depth}}; @@ -423,7 +425,7 @@ Vk::Device device{NoCreate}; DOXYGEN_IGNORE() Vk::Image image{device, Vk::ImageCreateInfo2D{ - Vk::ImageUsage::Sampled, VK_FORMAT_R8G8B8A8_SRGB, {1024, 1024}, 1 + Vk::ImageUsage::Sampled, PixelFormat::RGBA8Srgb, {1024, 1024}, 1 }, Vk::MemoryFlag::DeviceLocal }; /* [Image-creation] */ @@ -433,7 +435,7 @@ Vk::Image image{device, Vk::ImageCreateInfo2D{ Vk::Device device{NoCreate}; /* [Image-creation-custom-allocation] */ Vk::Image image{device, Vk::ImageCreateInfo2D{ - Vk::ImageUsage::Sampled, VK_FORMAT_R8G8B8A8_SRGB, {1024, 1024}, 1 + Vk::ImageUsage::Sampled, PixelFormat::RGBA8Srgb, {1024, 1024}, 1 }, NoAllocate }; @@ -457,7 +459,7 @@ Vk::Device device{NoCreate}; DOXYGEN_IGNORE() Vk::Image image{device, Vk::ImageCreateInfo2DArray{ /* created before */ - DOXYGEN_IGNORE(Vk::ImageUsage::Sampled, {}, {}, 1) + DOXYGEN_IGNORE(Vk::ImageUsage::Sampled, PixelFormat{}, {}, 1) }, DOXYGEN_IGNORE(Vk::MemoryFlag::DeviceLocal) }; @@ -628,8 +630,8 @@ DOXYGEN_IGNORE() Vk::RenderPass renderPass{device, Vk::RenderPassCreateInfo{} .setAttachments({ - VK_FORMAT_R8G8B8A8_SRGB, - VK_FORMAT_D24_UNORM_S8_UINT + Vk::PixelFormat::RGBA8Srgb, + Vk::PixelFormat::Depth24UnormStencil8UI }) .addSubpass(Vk::SubpassDescription{} .setColorAttachments({0}) @@ -644,8 +646,8 @@ Vk::Device device{DOXYGEN_IGNORE(NoCreate)}; /* [RenderPass-creation-load-store] */ Vk::RenderPass renderPass{device, Vk::RenderPassCreateInfo{} .setAttachments({ - {VK_FORMAT_R8G8B8A8_SRGB, Vk::AttachmentLoadOperation::Clear, {}}, - {VK_FORMAT_D24_UNORM_S8_UINT, Vk::AttachmentLoadOperation::Clear, {}}, + {Vk::PixelFormat::RGBA8Srgb, Vk::AttachmentLoadOperation::Clear, {}}, + {Vk::PixelFormat::Depth24UnormStencil8UI, Vk::AttachmentLoadOperation::Clear, {}}, }) DOXYGEN_IGNORE() }; @@ -657,11 +659,11 @@ Vk::Device device{DOXYGEN_IGNORE(NoCreate)}; /* [RenderPass-creation-layout] */ Vk::RenderPass renderPass{device, Vk::RenderPassCreateInfo{} .setAttachments({ - {VK_FORMAT_R8G8B8A8_SRGB, + {Vk::PixelFormat::RGBA8Srgb, Vk::AttachmentLoadOperation::Clear, {}, Vk::ImageLayout::ColorAttachment, Vk::ImageLayout::ColorAttachment}, - {VK_FORMAT_D24_UNORM_S8_UINT, + {Vk::PixelFormat::Depth24UnormStencil8UI, Vk::AttachmentLoadOperation::Clear, {}, Vk::ImageLayout::DepthStencilAttachment, Vk::ImageLayout::DepthStencilAttachment}, diff --git a/doc/vulkan-support.dox b/doc/vulkan-support.dox index 28ac33355..c5c5db277 100644 --- a/doc/vulkan-support.dox +++ b/doc/vulkan-support.dox @@ -117,7 +117,7 @@ Extension | Status --------------------------------------------------- | ------ @vk_extension{EXT,debug_report} @m_class{m-label m-danger} **deprecated** @m_class{m-label m-info} **instance** | | @vk_extension{EXT,debug_marker} @m_class{m-label m-danger} **deprecated** | | -@vk_extension{EXT,texture_compression_astc_hdr} | @ref Vk::vkFormat() only +@vk_extension{EXT,texture_compression_astc_hdr} | done @vk_extension{EXT,debug_utils} @m_class{m-label m-info} **instance** | | @vk_extension{EXT,validation_features} @m_class{m-label m-info} **instance** | | @vk_extension{EXT,vertex_attribute_divisor} | | @@ -128,7 +128,7 @@ Extension | Status @vk_extension{KHR,pipeline_library} | | @vk_extension{KHR,ray_tracing_pipeline} | | @vk_extension{KHR,ray_query} | | -@vk_extension{IMG,format_pvrtc} | @ref Vk::vkFormat() only +@vk_extension{IMG,format_pvrtc} | done */ diff --git a/src/Magnum/PixelFormat.h b/src/Magnum/PixelFormat.h index 750f62796..5cd56d6cb 100644 --- a/src/Magnum/PixelFormat.h +++ b/src/Magnum/PixelFormat.h @@ -51,11 +51,11 @@ and is convertible to them using @ref GL::pixelFormat() and about the mapping. Note that not every format is available on all targets, use @ref GL::hasPixelFormat() to check for its presence. -In case of Vulkan, corresponds to @type_vk_keyword{Format} and is convertible -to it using @ref Vk::vkFormat(Magnum::PixelFormat). See documentation of each -value for more information about the mapping. Note that not every format may be -available, use @ref Vk::hasVkFormat(Magnum::PixelFormat) to check for its -presence. +In case of Vulkan, corresponds to @ref Vk::PixelFormat and is convertible +to it using @ref Vk::pixelFormat(Magnum::PixelFormat). See documentation of +each value for more information about the mapping. Note that not every format +may be available, use @ref Vk::hasPixelFormat(Magnum::PixelFormat) to check for +its presence. For D3D, corresponds to @m_class{m-doc-external} [DXGI_FORMAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) and import is provided by the @ref Trade::DdsImporter "DdsImporter" plugin; for @@ -72,7 +72,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::Red and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::R8; - * @val_vk_keyword{FORMAT_R8_UNORM,Format}; + * @ref Vk::PixelFormat::R8Unorm; * @m_class{m-doc-external} [DXGI_FORMAT_R8_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR8Unorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr8unorm?language=objc). * @m_keywords{DXGI_FORMAT_R8_UNORM MTLPixelFormatR8Unorm} @@ -84,7 +84,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RG and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::RG8; - * @val_vk_keyword{FORMAT_R8G8_UNORM,Format}; + * @ref Vk::PixelFormat::RG8Unorm; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG8Unorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg8unorm?language=objc). * @m_keywords{DXGI_FORMAT_R8G8_UNORM MTLPixelFormatRG8Unorm} @@ -96,8 +96,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGB and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::RGB8 or - * @val_vk_keyword{FORMAT_R8G8B8_UNORM,Format}. No 24-bit D3D or Metal - * equivalent. + * @ref Vk::PixelFormat::RGB8Unorm. No 24-bit D3D or Metal equivalent. */ RGB8Unorm, @@ -106,7 +105,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBA and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::RGBA8; - * @val_vk_keyword{FORMAT_R8G8B8A8_UNORM,Format}; + * @ref Vk::PixelFormat::RGBA8Unorm; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8A8_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA8Unorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba8unorm?language=objc). * @m_keywords{DXGI_FORMAT_R8G8B8A8_UNORM MTLPixelFormatRGBA8Unorm} @@ -118,7 +117,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::Red and * @ref GL::PixelType::Byte, @ref GL::TextureFormat::R8Snorm; - * @val_vk_keyword{FORMAT_R8_SNORM,Format}; + * @ref Vk::PixelFormat::R8Snorm; * @m_class{m-doc-external} [DXGI_FORMAT_R8_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR8Snorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr8Snorm?language=objc). * @m_keywords{DXGI_FORMAT_R8_SNORM MTLPixelFormatR8Snorm} @@ -130,7 +129,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RG and * @ref GL::PixelType::Byte, @ref GL::TextureFormat::RG8Snorm; - * @val_vk_keyword{FORMAT_R8G8_SNORM,Format}; + * @ref Vk::PixelFormat::RG8Snorm; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG8Snorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg8snorm?language=objc). * @m_keywords{DXGI_FORMAT_R8G8_SNORM MTLPixelFormatRG8Snorm} @@ -142,8 +141,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGB and * @ref GL::PixelType::Byte, @ref GL::TextureFormat::RGB8Snorm; - * @val_vk_keyword{FORMAT_R8G8B8_SNORM,Format}. No 24-bit D3D or Metal - * equivalent. + * @ref Vk::PixelFormat::RGB8Snorm. No 24-bit D3D or Metal equivalent. */ RGB8Snorm, @@ -152,7 +150,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBA and * @ref GL::PixelType::Byte, @ref GL::TextureFormat::RGBA8Snorm; - * @val_vk_keyword{FORMAT_R8G8B8A8_SNORM,Format}; + * @ref Vk::PixelFormat::RGBA8Snorm; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8A8_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA8Snorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba8snorm?language=objc). * @m_keywords{DXGI_FORMAT_R8G8B8A8_SNORM MTLPixelFormatRGBA8Snorm} @@ -164,7 +162,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::Red and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::SR8; - * @val_vk_keyword{FORMAT_R8_SRGB,Format} or + * @ref Vk::PixelFormat::R8Srgb or * @m_class{m-doc-external} [MTLPixelFormatR8Unorm_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr8unorm_srgb?language=objc). No D3D equivalent. * @m_keywords{MTLPixelFormatR8Unorm_sRGB} * @m_since{2019,10} @@ -176,7 +174,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RG and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::SRG8; - * @val_vk_keyword{FORMAT_R8G8_SRGB,Format} or + * @ref Vk::PixelFormat::RG8Srgb or * @m_class{m-doc-external} [MTLPixelFormatRG8Unorm_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg8unorm_srgb?language=objc). No D3D equivalent. * @m_keywords{MTLPixelFormatRG8Unorm_sRGB} * @m_since{2019,10} @@ -188,8 +186,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGB and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::SRGB8 or - * @val_vk_keyword{FORMAT_R8G8B8_SRGB,Format}. No 24-bit D3D or Metal - * equivalent. + * @ref Vk::PixelFormat::RGB8Srgb. No 24-bit D3D or Metal equivalent. * @m_since{2019,10} */ RGB8Srgb, @@ -199,7 +196,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBA and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::SRGB8Alpha8; - * @val_vk_keyword{FORMAT_R8G8B8A8_SRGB,Format}; + * @ref Vk::PixelFormat::RGBA8Srgb; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8A8_UNORM_SRGB](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA8Unorm_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba8unorm_srgb?language=objc). * @m_keywords{DXGI_FORMAT_R8G8B8A8_UNORM_SRGB MTLPixelFormatRGBA8Unorm_sRGB} @@ -212,7 +209,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RedInteger and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::R8UI; - * @val_vk_keyword{FORMAT_R8_UINT,Format}; + * @ref Vk::PixelFormat::R8UI; * @m_class{m-doc-external} [DXGI_FORMAT_R8_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR8Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr8uint?language=objc). * @m_keywords{DXGI_FORMAT_R8_UINT MTLPixelFormatR8Uint} @@ -224,7 +221,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGInteger and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::RG8UI; - * @val_vk_keyword{FORMAT_R8G8_UINT,Format}; + * @ref Vk::PixelFormat::RG8UI; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG8Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg8uint?language=objc). * @m_keywords{DXGI_FORMAT_R8G8_UINT MTLPixelFormatRG8Uint} @@ -236,8 +233,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBInteger and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::RGB8UI or - * @val_vk_keyword{FORMAT_R8G8B8_UINT,Format}. No 24-bit D3D or Metal - * equivalent. + * @ref Vk::PixelFormat::RGB8UI. No 24-bit D3D or Metal equivalent. */ RGB8UI, @@ -246,7 +242,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBAInteger and * @ref GL::PixelType::UnsignedByte, @ref GL::TextureFormat::RGBA8UI; - * @val_vk_keyword{FORMAT_R8G8B8A8_UINT,Format}; + * @ref Vk::PixelFormat::RGBA8UI; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8A8_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA8Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba8uint?language=objc). * @m_keywords{DXGI_FORMAT_R8G8B8A8_UINT MTLPixelFormatRGBA8Uint} @@ -258,7 +254,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RedInteger and * @ref GL::PixelType::Byte, @ref GL::TextureFormat::R8I; - * @val_vk_keyword{FORMAT_R8_SINT,Format}; + * @ref Vk::PixelFormat::R8I; * @m_class{m-doc-external} [DXGI_FORMAT_R8_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR8Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr8sint?language=objc). * @m_keywords{DXGI_FORMAT_R8_SINT MTLPixelFormatR8Sint} @@ -270,7 +266,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGInteger and * @ref GL::PixelType::Byte, @ref GL::TextureFormat::RG8I; - * @val_vk_keyword{FORMAT_R8G8_SINT,Format}; + * @ref Vk::PixelFormat::RG8I; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG8Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg8sint?language=objc). * @m_keywords{DXGI_FORMAT_R8G8_SINT MTLPixelFormatRG8Sint} @@ -282,7 +278,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBInteger and * @ref GL::PixelType::Byte, @ref GL::TextureFormat::RGB8I; - * @val_vk_keyword{FORMAT_R8G8B8_SINT,Format}. No 24-bit D3D or Metal + * @ref Vk::PixelFormat::RGB8I. No 24-bit D3D or Metal * equivalent. */ RGB8I, @@ -292,7 +288,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBAInteger and * @ref GL::PixelType::Byte, @ref GL::TextureFormat::RGBA8I; - * @val_vk_keyword{FORMAT_R8G8B8A8_SINT,Format}; + * @ref Vk::PixelFormat::RGBA8I; * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8A8_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA8Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba8sint?language=objc). * @m_keywords{DXGI_FORMAT_R8G8B8A8_SINT MTLPixelFormatRGBA8Sint} @@ -304,7 +300,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::Red and * @ref GL::PixelType::UnsignedShort, @ref GL::TextureFormat::R16; - * @val_vk_keyword{FORMAT_R16_UNORM,Format}; + * @ref Vk::PixelFormat::R16Unorm; * @m_class{m-doc-external} [DXGI_FORMAT_R16_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR16Unorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr16unorm?language=objc). * @m_keywords{DXGI_FORMAT_R16_UNORM MTLPixelFormatR16Unorm} @@ -316,7 +312,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RG and * @ref GL::PixelType::UnsignedShort, @ref GL::TextureFormat::RG16; - * @val_vk_keyword{FORMAT_R16G16_UNORM,Format}; + * @ref Vk::PixelFormat::RG16Unorm; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG16Unorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg16unorm?language=objc). * @m_keywords{DXGI_FORMAT_R16G16_UNORM MTLPixelFormatRG16Unorm} @@ -328,8 +324,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGB and * @ref GL::PixelType::UnsignedShort, @ref GL::TextureFormat::RGB16 or - * @val_vk_keyword{FORMAT_R16G16B16_UNORM,Format}. No 48-bit D3D or Metal - * equivalent. + * @ref Vk::PixelFormat::RGB16Unorm. No 48-bit D3D or Metal equivalent. */ RGB16Unorm, @@ -338,7 +333,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBA and * @ref GL::PixelType::UnsignedShort, @ref GL::TextureFormat::RGBA16; - * @val_vk_keyword{FORMAT_R16G16B16A16_UNORM,Format}; + * @ref Vk::PixelFormat::RGBA16Unorm; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16A16_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA16Unorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba16unorm?language=objc). * @m_keywords{DXGI_FORMAT_R16G16B16A16_UNORM MTLPixelFormatRGBA16Unorm} @@ -350,7 +345,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::Red and * @ref GL::PixelType::Short, @ref GL::TextureFormat::R16Snorm; - * @val_vk_keyword{FORMAT_R16_SNORM,Format}; + * @ref Vk::PixelFormat::R16Snorm; * @m_class{m-doc-external} [DXGI_FORMAT_R16_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR16Snorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr16snorm?language=objc). * @m_keywords{DXGI_FORMAT_R16_SNORM MTLPixelFormatR16Snorm} @@ -362,7 +357,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RG and * @ref GL::PixelType::Short, @ref GL::TextureFormat::RG16Snorm; - * @val_vk_keyword{FORMAT_R16G16_SNORM,Format}; + * @ref Vk::PixelFormat::RG16Snorm; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG16Snorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg16snorm?language=objc). * @m_keywords{DXGI_FORMAT_R16G16_SNORM MTLPixelFormatRG16Snorm} @@ -374,8 +369,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGB and * @ref GL::PixelType::Short, @ref GL::TextureFormat::RGB16Snorm; - * @val_vk_keyword{FORMAT_R16G16B16_SNORM,Format}. No 48-bit D3D or Metal - * equivalent. + * @ref Vk::PixelFormat::RGB16Snorm. No 48-bit D3D or Metal equivalent. */ RGB16Snorm, @@ -384,7 +378,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBA and * @ref GL::PixelType::Short, @ref GL::TextureFormat::RGBA16Snorm; - * @val_vk_keyword{FORMAT_R16G16B16A16_SNORM,Format}; + * @ref Vk::PixelFormat::RGBA16Snorm; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16A16_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA16Snorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba16snorm?language=objc). * @m_keywords{DXGI_FORMAT_R16G16B16A16_SNORM MTLPixelFormatRGBA16Snorm} @@ -396,7 +390,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RedInteger and * @ref GL::PixelType::UnsignedShort, @ref GL::TextureFormat::R16UI; - * @val_vk_keyword{FORMAT_R16_UINT,Format}; + * @ref Vk::PixelFormat::R16UI; * @m_class{m-doc-external} [DXGI_FORMAT_R16_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR16Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr16uint?language=objc). * @m_keywords{DXGI_FORMAT_R16_UINT MTLPixelFormatR16Uint} @@ -408,7 +402,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGInteger and * @ref GL::PixelType::UnsignedShort, @ref GL::TextureFormat::RG16UI; - * @val_vk_keyword{FORMAT_R16G16_UINT,Format}; + * @ref Vk::PixelFormat::RG16UI; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG16Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg16uint?language=objc). * @m_keywords{DXGI_FORMAT_R16G16_UINT MTLPixelFormatRG16Uint} @@ -420,8 +414,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBInteger and * @ref GL::PixelType::UnsignedShort, @ref GL::TextureFormat::RGB16UI; - * @val_vk_keyword{FORMAT_R16G16B16_UINT,Format}. No 48-bit D3D or Metal - * equivalent. + * @ref Vk::PixelFormat::RGB16UI. No 48-bit D3D or Metal equivalent. */ RGB16UI, @@ -430,7 +423,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBAInteger and * @ref GL::PixelType::UnsignedShort, @ref GL::TextureFormat::RGBA16UI; - * @val_vk_keyword{FORMAT_R16G16B16A16_UINT,Format}; + * @ref Vk::PixelFormat::RGBA16UI; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16A16_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA16Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba16uint?language=objc). * @m_keywords{DXGI_FORMAT_R16G16B16A16_UINT MTLPixelFormatRGBA16Uint} @@ -442,7 +435,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RedInteger and * @ref GL::PixelType::Short, @ref GL::TextureFormat::R16I; - * @val_vk_keyword{FORMAT_R16_SINT,Format}; + * @ref Vk::PixelFormat::R16I; * @m_class{m-doc-external} [DXGI_FORMAT_R16_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR16Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr16sint?language=objc). * @m_keywords{DXGI_FORMAT_R16_SINT MTLPixelFormatR16Sint} @@ -454,7 +447,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGInteger and * @ref GL::PixelType::Short, @ref GL::TextureFormat::RG16I; - * @val_vk_keyword{FORMAT_R16G16_SINT,Format}; + * @ref Vk::PixelFormat::RG16I; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG16Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg16sint?language=objc). * @m_keywords{DXGI_FORMAT_R16G16_SINT MTLPixelFormatRG16Sint} @@ -466,8 +459,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBInteger and * @ref GL::PixelType::Short, @ref GL::TextureFormat::RGB16I; - * @val_vk_keyword{FORMAT_R16G16B16_SINT,Format}. No 48-bit D3D or Metal - * equivalent. + * @ref Vk::PixelFormat::RGB16I. No 48-bit D3D or Metal equivalent. */ RGB16I, @@ -476,7 +468,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBAInteger and * @ref GL::PixelType::Short, @ref GL::TextureFormat::RGBA16I; - * @val_vk_keyword{FORMAT_R16G16B16A16_SINT,Format}; + * @ref Vk::PixelFormat::RGBA16I; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16A16_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA16Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba16sint?language=objc). * @m_keywords{DXGI_FORMAT_R16G16B16A16_SINT MTLPixelFormatRGBA16Sint} @@ -488,7 +480,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RedInteger and * @ref GL::PixelType::UnsignedInt, @ref GL::TextureFormat::R32UI; - * @val_vk_keyword{FORMAT_R32_UINT,Format}; + * @ref Vk::PixelFormat::R32UI; * @m_class{m-doc-external} [DXGI_FORMAT_R32_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR32Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr32uint?language=objc). * @m_keywords{DXGI_FORMAT_R32_UINT MTLPixelFormatR32Uint} @@ -500,7 +492,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGInteger and * @ref GL::PixelType::UnsignedInt, @ref GL::TextureFormat::RG32UI; - * @val_vk_keyword{FORMAT_R32G32_UINT,Format}; + * @ref Vk::PixelFormat::RG32UI; * @m_class{m-doc-external} [DXGI_FORMAT_R32G32_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG32Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg32uint?language=objc). * @m_keywords{DXGI_FORMAT_R32G32_UINT MTLPixelFormatRG32Uint} @@ -512,7 +504,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBInteger and * @ref GL::PixelType::UnsignedInt, @ref GL::TextureFormat::RGB32UI; - * @val_vk_keyword{FORMAT_R32G32B32_UINT,Format} or + * @ref Vk::PixelFormat::RGB32UI or * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format). * No 96-bit Metal equivalent. * @m_keywords{DXGI_FORMAT_R32G32B32_UINT} @@ -524,7 +516,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBAInteger and * @ref GL::PixelType::UnsignedInt, @ref GL::TextureFormat::RGBA32UI; - * @val_vk_keyword{FORMAT_R32G32B32A32_UINT,Format}; + * @ref Vk::PixelFormat::RGBA32UI; * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32A32_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA32Uint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba32uint?language=objc). * @m_keywords{DXGI_FORMAT_R32G32B32A32_UINT MTLPixelFormatRGBA32Uint} @@ -536,7 +528,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RedInteger and * @ref GL::PixelType::Int, @ref GL::TextureFormat::R32I; - * @val_vk_keyword{FORMAT_R32_SINT,Format}; + * @ref Vk::PixelFormat::R32I; * @m_class{m-doc-external} [DXGI_FORMAT_R32_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR32Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr32sint?language=objc). * @m_keywords{DXGI_FORMAT_R32_SINT MTLPixelFormatR32Sint} @@ -548,7 +540,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGInteger and * @ref GL::PixelType::Int, @ref GL::TextureFormat::RG32I; - * @val_vk_keyword{FORMAT_R32G32_SINT,Format}; + * @ref Vk::PixelFormat::RG32I; * @m_class{m-doc-external} [DXGI_FORMAT_R32G32_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG32Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg32sint?language=objc). * @m_keywords{DXGI_FORMAT_R32G32_SINT MTLPixelFormatRG32Sint} @@ -560,7 +552,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBInteger and * @ref GL::PixelType::Int, @ref GL::TextureFormat::RGB32I; - * @val_vk_keyword{FORMAT_R32G32B32_SINT,Format} or + * @ref Vk::PixelFormat::RGB32I or * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format). * No 96-bit Metal equivalent. * @m_keywords{DXGI_FORMAT_R32G32B32_SINT} @@ -572,7 +564,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBAInteger and * @ref GL::PixelType::Int, @ref GL::TextureFormat::RGBA32I; - * @val_vk_keyword{FORMAT_R32G32B32A32_SINT,Format}; + * @ref Vk::PixelFormat::RGBA32I; * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32A32_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA32Sint](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba32sint?language=objc). * @m_keywords{DXGI_FORMAT_R32G32B32A32_SINT MTLPixelFormatRGBA32Sint} @@ -583,7 +575,7 @@ enum class PixelFormat: UnsignedInt { * Red component, half float. * * Corresponds to @ref GL::PixelFormat::Red and @ref GL::PixelType::Half, - * @ref GL::TextureFormat::R16F; @val_vk_keyword{FORMAT_R16_SFLOAT,Format}; + * @ref GL::TextureFormat::R16F; @ref Vk::PixelFormat::R16F; * @m_class{m-doc-external} [DXGI_FORMAT_R16_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR16Float](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr16float?language=objc). * @see @ref Half, @ref Math::packHalf(), @ref Math::unpackHalf() @@ -595,8 +587,7 @@ enum class PixelFormat: UnsignedInt { * Red and green component, half float. * * Corresponds to @ref GL::PixelFormat::RG and @ref GL::PixelType::Half, - * @ref GL::TextureFormat::RG16F; - * @val_vk_keyword{FORMAT_R16G16_SFLOAT,Format}; + * @ref GL::TextureFormat::RG16F; @ref Vk::PixelFormat::RG16F; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG16Float](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg16float?language=objc). * @see @ref Half, @ref Math::packHalf(), @ref Math::unpackHalf() @@ -608,9 +599,8 @@ enum class PixelFormat: UnsignedInt { * RGB, half float. * * Corresponds to @ref GL::PixelFormat::RGB and @ref GL::PixelType::Half, - * @ref GL::TextureFormat::RGB16F; - * @val_vk_keyword{FORMAT_R16G16B16_SFLOAT,Format}. No 48-bit D3D or Metal - * equivalent. + * @ref GL::TextureFormat::RGB16F; @ref Vk::PixelFormat::RGB16F. No 48-bit + * D3D or Metal equivalent. * @see @ref Half, @ref Math::packHalf(), @ref Math::unpackHalf() */ RGB16F, @@ -619,8 +609,7 @@ enum class PixelFormat: UnsignedInt { * RGBA, half float. * * Corresponds to @ref GL::PixelFormat::RGBA and @ref GL::PixelType::Half, - * @ref GL::TextureFormat::RGBA16F; - * @val_vk_keyword{FORMAT_R16G16B16A16_SFLOAT,Format}; + * @ref GL::TextureFormat::RGBA16F; @ref Vk::PixelFormat::RGBA16F; * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16A16_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA16Float](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba16float?language=objc). * @see @ref Half, @ref Math::packHalf(), @ref Math::unpackHalf() @@ -633,7 +622,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::Red and * @ref GL::PixelType::Float, @ref GL::TextureFormat::R32F; - * @val_vk_keyword{FORMAT_R32_SFLOAT,Format}; + * @ref Vk::PixelFormat::R32F; * @m_class{m-doc-external} [DXGI_FORMAT_R32_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatR32Float](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatr32float?language=objc). * @m_keywords{DXGI_FORMAT_R32_FLOAT MTLPixelFormatR32Float} @@ -645,7 +634,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RG and * @ref GL::PixelType::Float, @ref GL::TextureFormat::RG32F; - * @val_vk_keyword{FORMAT_R32G32_SFLOAT,Format}; + * @ref Vk::PixelFormat::RG32F; * @m_class{m-doc-external} [DXGI_FORMAT_R32G32_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRG32Float](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrg32float?language=objc). * @m_keywords{DXGI_FORMAT_R32G32_FLOAT MTLPixelFormatRG32Float} @@ -657,7 +646,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGB and * @ref GL::PixelType::Float, @ref GL::TextureFormat::RGB32F; - * @val_vk_keyword{FORMAT_R32G32B32_SFLOAT,Format} or + * @ref Vk::PixelFormat::RGB32F or * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format). * No 96-bit Metal equivalent. * @m_keywords{DXGI_FORMAT_R32G32B32_UINT} @@ -669,7 +658,7 @@ enum class PixelFormat: UnsignedInt { * * Corresponds to @ref GL::PixelFormat::RGBA and * @ref GL::PixelType::Float, @ref GL::TextureFormat::RGBA32F; - * @val_vk_keyword{FORMAT_R32G32B32A32_SFLOAT,Format}; + * @ref Vk::PixelFormat::RGBA32F; * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32A32_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatRGBA32Float](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatrgba32float?language=objc). * @m_keywords{DXGI_FORMAT_R32G32B32A32_FLOAT MTLPixelFormatRGBA32Float} @@ -744,10 +733,10 @@ each value for more information about the mapping. Note that not every format is available on all targets, use @ref GL::hasCompressedPixelFormat() to check for its presence. -In case of Vulkan, corresponds to @type_vk_keyword{Format} and is convertible -to it using @ref Vk::vkFormat(Magnum::CompressedPixelFormat). See documentation +In case of Vulkan, corresponds to @ref Vk::PixelFormat and is convertible to it +using @ref Vk::pixelFormat(Magnum::CompressedPixelFormat). See documentation of each value for more information about the mapping. Note that not every -format may be available, use @ref Vk::hasVkFormat(Magnum::CompressedPixelFormat) +format may be available, use @ref Vk::hasPixelFormat(Magnum::CompressedPixelFormat) to check for its presence. For D3D, corresponds to @m_class{m-doc-external} [DXGI_FORMAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) @@ -766,7 +755,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBS3tcDxt1, * @ref GL::TextureFormat::CompressedRGBS3tcDxt1 or - * @val_vk_keyword{FORMAT_BC1_RGB_UNORM_BLOCK,Format}. No D3D or Metal + * @ref Vk::PixelFormat::CompressedBc1RGBUnorm. No D3D or Metal * equivalent. */ Bc1RGBUnorm = 1, @@ -777,7 +766,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGBS3tcDxt1, * @ref GL::TextureFormat::CompressedSRGBS3tcDxt1 or - * @val_vk_keyword{FORMAT_BC1_RGB_SRGB_BLOCK,Format}. No D3D or Metal + * @ref Vk::PixelFormat::CompressedBc1RGBSrgb. No D3D or Metal * equivalent. * @m_since{2019,10} */ @@ -789,7 +778,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAS3tcDxt1, * @ref GL::TextureFormat::CompressedRGBAS3tcDxt1; - * @val_vk_keyword{FORMAT_BC1_RGBA_UNORM_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc1RGBAUnorm; * @m_class{m-doc-external} [DXGI_FORMAT_BC1_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC1_RGBA](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc1_rgba?language=objc). * @m_keywords{DXGI_FORMAT_BC1_UNORM MTLPixelFormatBC1_RGBA} @@ -802,7 +791,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaS3tcDxt1, * @ref GL::TextureFormat::CompressedSRGBAlphaS3tcDxt1; - * @val_vk_keyword{FORMAT_BC1_RGBA_SRGB_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc1RGBASrgb; * @m_class{m-doc-external} [DXGI_FORMAT_BC1_UNORM_SRGB](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC1_RGBA_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc1_rgba_srgb?language=objc). * @m_keywords{DXGI_FORMAT_BC1_UNORM_SRGB MTLPixelFormatBC1_RGBA_sRGB} @@ -816,7 +805,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAS3tcDxt3, * @ref GL::TextureFormat::CompressedRGBAS3tcDxt3; - * @val_vk_keyword{FORMAT_BC2_UNORM_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc2RGBAUnorm; * @m_class{m-doc-external} [DXGI_FORMAT_BC2_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC2_RGBA](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc2_rgba?language=objc). * @m_keywords{DXGI_FORMAT_BC2_UNORM MTLPixelFormatBC2_RGBA} @@ -829,7 +818,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaS3tcDxt3, * @ref GL::TextureFormat::CompressedSRGBAlphaS3tcDxt3; - * @val_vk_keyword{FORMAT_BC2_SRGB_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc2RGBASrgb; * @m_class{m-doc-external} [DXGI_FORMAT_BC2_UNORM_SRGB](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC2_RGBA_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc2_rgba_srgb?language=objc). * @m_keywords{DXGI_FORMAT_BC2_UNORM_SRGB MTLPixelFormatBC2_RGBA_sRGB} @@ -843,7 +832,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAS3tcDxt5, * @ref GL::TextureFormat::CompressedRGBAS3tcDxt5; - * @val_vk_keyword{FORMAT_BC3_UNORM_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc3RGBAUnorm; * @m_class{m-doc-external} [DXGI_FORMAT_BC3_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC3_RGBA](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc3_rgba?language=objc). * @m_keywords{DXGI_FORMAT_BC3_UNORM MTLPixelFormatBC3_RGBA} @@ -856,7 +845,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaS3tcDxt5, * @ref GL::TextureFormat::CompressedSRGBAlphaS3tcDxt5; - * @val_vk_keyword{FORMAT_BC3_SRGB_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc3RGBASrgb; * @m_class{m-doc-external} [DXGI_FORMAT_BC3_UNORM_SRGB](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC3_RGBA_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc3_rgba_srgb?language=objc). * @m_keywords{DXGI_FORMAT_BC3_UNORM_SRGB MTLPixelFormatBC3_RGBA_sRGB} @@ -870,7 +859,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RedRgtc1, * @ref GL::TextureFormat::CompressedRedRgtc1; - * @val_vk_keyword{FORMAT_BC4_UNORM_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc4RUnorm; * @m_class{m-doc-external} [DXGI_FORMAT_BC4_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC4_RUnorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc4_runorm?language=objc). * @m_keywords{DXGI_FORMAT_BC4_UNORM MTLPixelFormatBC4_RUnorm} @@ -884,7 +873,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SignedRedRgtc1, * @ref GL::TextureFormat::CompressedSignedRedRgtc1; - * @val_vk_keyword{FORMAT_BC4_SNORM_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc4RSnorm; * @m_class{m-doc-external} [DXGI_FORMAT_BC4_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC4_RSnorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc4_rsnorm?language=objc). * @m_keywords{DXGI_FORMAT_BC4_SNORM MTLPixelFormatBC4_RSnorm} @@ -898,7 +887,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGRgtc2, * @ref GL::TextureFormat::CompressedRGRgtc2; - * @val_vk_keyword{FORMAT_BC5_UNORM_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc5RGUnorm; * @m_class{m-doc-external} [DXGI_FORMAT_BC5_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC5_RGUnorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc5_rgunorm?language=objc). * @m_keywords{DXGI_FORMAT_BC5_UNORM MTLPixelFormatBC5_RGUnorm} @@ -912,7 +901,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SignedRGRgtc2, * @ref GL::TextureFormat::CompressedSignedRGRgtc2; - * @val_vk_keyword{FORMAT_BC5_SNORM_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc5RGSnorm; * @m_class{m-doc-external} [DXGI_FORMAT_BC5_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC5_RGSnorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc5_rgsnorm?language=objc). * @m_keywords{DXGI_FORMAT_BC5_SNORM MTLPixelFormatBC5_RGSnorm} @@ -926,7 +915,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBBptcUnsignedFloat, * @ref GL::TextureFormat::CompressedRGBBptcUnsignedFloat; - * @val_vk_keyword{FORMAT_BC6H_UFLOAT_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc6hRGBUfloat; * @m_class{m-doc-external} [DXGI_FORMAT_BC6H_UF16](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC6H_RGBUfloat](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc6h_rgbufloat?language=objc). * @m_keywords{DXGI_FORMAT_BC6H_UF16 MTLPixelFormatBC6H_RGBUfloat} @@ -940,7 +929,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBBptcSignedFloat, * @ref GL::TextureFormat::CompressedRGBBptcSignedFloat; - * @val_vk_keyword{FORMAT_BC6H_SFLOAT_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc6hRGBSfloat; * @m_class{m-doc-external} [DXGI_FORMAT_BC6H_SF16](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC6H_RGBFloat](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc6h_rgbfloat?language=objc). * @m_keywords{DXGI_FORMAT_BC6H_UF16 MTLPixelFormatBC6H_RGBFloat} @@ -954,7 +943,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBABptcUnorm, * @ref GL::TextureFormat::CompressedRGBABptcUnorm; - * @val_vk_keyword{FORMAT_BC7_UNORM_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc7RGBAUnorm; * @m_class{m-doc-external} [DXGI_FORMAT_BC7_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC7_RGBAUnorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc7_rgbaunorm?language=objc). * @m_keywords{DXGI_FORMAT_BC7_UNORM MTLPixelFormatBC7_RGBAUnorm} @@ -968,7 +957,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaBptcUnorm, * @ref GL::TextureFormat::CompressedSRGBAlphaBptcUnorm; - * @val_vk_keyword{FORMAT_BC7_SRGB_BLOCK,Format}; + * @ref Vk::PixelFormat::CompressedBc7RGBASrgb; * @m_class{m-doc-external} [DXGI_FORMAT_BC7_UNORM_SRGB](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) * or @m_class{m-doc-external} [MTLPixelFormatBC7_RGBAUnorm_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatbc7_rgbaunorm_srgb?language=objc). * @m_keywords{DXGI_FORMAT_BC7_UNORM_SRGB MTLPixelFormatBC7_RGBAUnorm_sRGB} @@ -982,7 +971,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::R11Eac, * @ref GL::TextureFormat::CompressedR11Eac; - * @val_vk_keyword{FORMAT_EAC_R11_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEacR11Unorm or * @m_class{m-doc-external} [MTLPixelFormatEAC_R11Unorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformateac_r11unorm?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatEAC_R11Unorm} @@ -996,7 +985,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SignedR11Eac, * @ref GL::TextureFormat::CompressedSignedR11Eac; - * @val_vk_keyword{FORMAT_EAC_R11_SNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEacR11Snorm or * @m_class{m-doc-external} [MTLPixelFormatEAC_R11Snorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformateac_r11snorm?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatEAC_R11Unorm} @@ -1010,7 +999,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RG11Eac, * @ref GL::TextureFormat::CompressedRG11Eac; - * @val_vk_keyword{FORMAT_EAC_R11G11_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEacRG11Unorm or * @m_class{m-doc-external} [MTLPixelFormatEAC_RG11Unorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformateac_rg11unorm?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatEAC_R11Unorm} @@ -1024,7 +1013,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SignedRG11Eac, * @ref GL::TextureFormat::CompressedSignedRG11Eac; - * @val_vk_keyword{FORMAT_EAC_R11G11_SNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEacRG11Snorm or * @m_class{m-doc-external} [MTLPixelFormatEAC_RG11Snorm](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformateac_rg11snorm?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatEAC_RG11Snorm} @@ -1038,7 +1027,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGB8Etc2, * @ref GL::TextureFormat::CompressedRGB8Etc2; - * @val_vk_keyword{FORMAT_ETC2_R8G8B8_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEtc2RGB8Unorm or * @m_class{m-doc-external} [MTLPixelFormatETC2_RGB8](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatetc2_rgb8?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatETC2_RGB8} @@ -1052,7 +1041,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Etc2, * @ref GL::TextureFormat::CompressedSRGB8Etc2; - * @val_vk_keyword{FORMAT_ETC2_R8G8B8_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEtc2RGB8Srgb or * @m_class{m-doc-external} [MTLPixelFormatETC2_RGB8_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatetc2_rgb8_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatETC2_RGB8_sRGB} @@ -1066,7 +1055,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGB8PunchthroughAlpha1Etc2, * @ref GL::TextureFormat::CompressedRGB8PunchthroughAlpha1Etc2; - * @val_vk_keyword{FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEtc2RGB8A1Unorm or * @m_class{m-doc-external} [MTLPixelFormatETC2_RGB8A1](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatetc2_rgb8a1?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatETC2_RGB8A1} @@ -1080,7 +1069,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8PunchthroughAlpha1Etc2, * @ref GL::TextureFormat::CompressedSRGB8PunchthroughAlpha1Etc2; - * @val_vk_keyword{FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEtc2RGB8A1Srgb or * @m_class{m-doc-external} [MTLPixelFormatETC2_RGB8A1_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatetc2_rgb8a1_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatETC2_RGB8A1_sRGB} @@ -1094,7 +1083,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBA8Etc2Eac, * @ref GL::TextureFormat::CompressedRGBA8Etc2Eac; - * @val_vk_keyword{FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEtc2RGBA8Unorm or * @m_class{m-doc-external} [MTLPixelFormatEAC_RGBA8](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformateac_rgba8?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatEAC_RGBA8} @@ -1108,7 +1097,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Etc2Eac, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Etc2Eac; - * @val_vk_keyword{FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedEtc2RGBA8Srgb or * @m_class{m-doc-external} [MTLPixelFormatEAC_RGBA8_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformateac_rgba8_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatEAC_RGBA8_sRGB} @@ -1122,7 +1111,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc4x4, * @ref GL::TextureFormat::CompressedRGBAAstc4x4; - * @val_vk_keyword{FORMAT_ASTC_4x4_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc4x4RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_4x4_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_4x4_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_4x4_LDR} @@ -1137,7 +1126,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc4x4, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc4x4; - * @val_vk_keyword{FORMAT_ASTC_4x4_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc4x4RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_4x4_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_4x4_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_4x4_sRGB} @@ -1151,7 +1140,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc4x4, * @ref GL::TextureFormat::CompressedRGBAAstc4x4; - * @val_vk_keyword{FORMAT_ASTC_4x4_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc4x4RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_4x4_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_4x4_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_4x4_HDR} @@ -1165,7 +1154,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc5x4, * @ref GL::TextureFormat::CompressedRGBAAstc5x4; - * @val_vk_keyword{FORMAT_ASTC_5x4_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc5x4RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_5x4_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_5x4_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_5x4_LDR} @@ -1180,7 +1169,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc5x4, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc5x4; - * @val_vk_keyword{FORMAT_ASTC_5x4_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc5x4RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_5x4_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_5x4_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_5x4_sRGB} @@ -1194,7 +1183,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc5x4, * @ref GL::TextureFormat::CompressedRGBAAstc5x4; - * @val_vk_keyword{FORMAT_ASTC_5x4_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc5x4RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_5x4_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_5x4_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_5x4_HDR} @@ -1208,7 +1197,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc5x5, * @ref GL::TextureFormat::CompressedRGBAAstc5x5; - * @val_vk_keyword{FORMAT_ASTC_5x5_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc5x5RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_5x5_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_5x5_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_5x5_LDR} @@ -1223,7 +1212,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc5x5, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc5x5; - * @val_vk_keyword{FORMAT_ASTC_5x5_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc5x5RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_5x5_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_5x5_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_5x5_sRGB} @@ -1237,7 +1226,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc5x5, * @ref GL::TextureFormat::CompressedRGBAAstc5x5; - * @val_vk_keyword{FORMAT_ASTC_5x5_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc5x5RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_5x5_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_5x5_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_5x5_HDR} @@ -1251,7 +1240,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc6x5, * @ref GL::TextureFormat::CompressedRGBAAstc6x5; - * @val_vk_keyword{FORMAT_ASTC_6x5_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc6x5RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_6x5_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_6x5_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_6x5_LDR} @@ -1266,7 +1255,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc6x5, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc6x5; - * @val_vk_keyword{FORMAT_ASTC_6x5_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc6x5RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_6x5_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_6x5_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_6x5_sRGB} @@ -1280,7 +1269,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc6x5, * @ref GL::TextureFormat::CompressedRGBAAstc6x5; - * @val_vk_keyword{FORMAT_ASTC_6x5_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc6x5RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_6x5_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_6x5_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_6x5_HDR} @@ -1294,7 +1283,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc6x6, * @ref GL::TextureFormat::CompressedRGBAAstc6x6; - * @val_vk_keyword{FORMAT_ASTC_6x6_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc6x6RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_6x6_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_6x6_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_6x6_LDR} @@ -1309,7 +1298,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc6x6, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc6x6; - * @val_vk_keyword{FORMAT_ASTC_6x6_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc6x6RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_6x6_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_6x6_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_6x6_sRGB} @@ -1323,7 +1312,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc6x6, * @ref GL::TextureFormat::CompressedRGBAAstc6x6; - * @val_vk_keyword{FORMAT_ASTC_6x6_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc6x6RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_6x6_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_6x6_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_6x6_HDR} @@ -1337,7 +1326,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc8x5, * @ref GL::TextureFormat::CompressedRGBAAstc8x5; - * @val_vk_keyword{FORMAT_ASTC_8x5_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x5RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x5_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x5_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x5_LDR} @@ -1352,7 +1341,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc8x5, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc8x5; - * @val_vk_keyword{FORMAT_ASTC_8x5_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x5RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x5_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x5_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x5_sRGB} @@ -1366,7 +1355,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc8x5, * @ref GL::TextureFormat::CompressedRGBAAstc8x5; - * @val_vk_keyword{FORMAT_ASTC_8x5_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x5RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x5_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x5_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x5_HDR} @@ -1380,7 +1369,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc8x6, * @ref GL::TextureFormat::CompressedRGBAAstc8x6; - * @val_vk_keyword{FORMAT_ASTC_8x6_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x6RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x6_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x6_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x6_LDR} @@ -1395,7 +1384,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc8x6, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc8x6; - * @val_vk_keyword{FORMAT_ASTC_8x6_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x6RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x6_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x6_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x6_sRGB} @@ -1409,7 +1398,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc8x6, * @ref GL::TextureFormat::CompressedRGBAAstc8x6; - * @val_vk_keyword{FORMAT_ASTC_8x6_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x6RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x6_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x6_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x6_HDR} @@ -1423,7 +1412,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc8x8, * @ref GL::TextureFormat::CompressedRGBAAstc8x8; - * @val_vk_keyword{FORMAT_ASTC_8x8_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x8RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x8_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x8_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x8_LDR} @@ -1438,7 +1427,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc8x8, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc8x8; - * @val_vk_keyword{FORMAT_ASTC_8x8_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x8RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x8_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x8_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x8_sRGB} @@ -1452,7 +1441,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc8x8, * @ref GL::TextureFormat::CompressedRGBAAstc8x8; - * @val_vk_keyword{FORMAT_ASTC_8x8_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc8x8RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_8x8_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_8x8_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_8x8_HDR} @@ -1466,7 +1455,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc10x5, * @ref GL::TextureFormat::CompressedRGBAAstc10x5; - * @val_vk_keyword{FORMAT_ASTC_10x5_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x5RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x5_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x5_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x5_LDR} @@ -1481,7 +1470,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc10x5, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc10x5; - * @val_vk_keyword{FORMAT_ASTC_10x5_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x5RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x5_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x5_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x5_sRGB} @@ -1495,7 +1484,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc10x5, * @ref GL::TextureFormat::CompressedRGBAAstc10x5; - * @val_vk_keyword{FORMAT_ASTC_10x5_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x5RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x5_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x5_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x5_HDR} @@ -1509,7 +1498,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc10x6, * @ref GL::TextureFormat::CompressedRGBAAstc10x6; - * @val_vk_keyword{FORMAT_ASTC_10x6_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x6RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x6_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x6_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x6_LDR} @@ -1524,7 +1513,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc10x6, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc10x6; - * @val_vk_keyword{FORMAT_ASTC_10x6_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x6RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x6_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x6_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x6_sRGB} @@ -1538,7 +1527,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc10x6, * @ref GL::TextureFormat::CompressedRGBAAstc10x6; - * @val_vk_keyword{FORMAT_ASTC_10x6_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x6RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x6_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x6_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x6_HDR} @@ -1552,7 +1541,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc10x8, * @ref GL::TextureFormat::CompressedRGBAAstc10x8; - * @val_vk_keyword{FORMAT_ASTC_10x8_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x8RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x8_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x8_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x8_LDR} @@ -1567,7 +1556,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc10x8, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc10x8; - * @val_vk_keyword{FORMAT_ASTC_10x8_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x8RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x8_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x8_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x8_sRGB} @@ -1581,7 +1570,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc10x8, * @ref GL::TextureFormat::CompressedRGBAAstc10x8; - * @val_vk_keyword{FORMAT_ASTC_10x8_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x8RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x8_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x8_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x8_HDR} @@ -1595,7 +1584,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc10x10, * @ref GL::TextureFormat::CompressedRGBAAstc10x10; - * @val_vk_keyword{FORMAT_ASTC_10x10_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x10RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x10_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x10_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x10_LDR} @@ -1610,7 +1599,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc10x10, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc10x10; - * @val_vk_keyword{FORMAT_ASTC_10x10_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x10RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x10_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x10_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x10_sRGB} @@ -1624,7 +1613,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc10x10, * @ref GL::TextureFormat::CompressedRGBAAstc10x10; - * @val_vk_keyword{FORMAT_ASTC_10x10_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc10x10RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_10x10_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_10x10_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_10x10_HDR} @@ -1638,7 +1627,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc12x10, * @ref GL::TextureFormat::CompressedRGBAAstc12x10; - * @val_vk_keyword{FORMAT_ASTC_12x10_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc12x10RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_12x10_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_12x10_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_12x10_LDR} @@ -1653,7 +1642,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc12x10, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc12x10; - * @val_vk_keyword{FORMAT_ASTC_12x10_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc12x10RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_12x10_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_12x10_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_12x10_sRGB} @@ -1667,7 +1656,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc12x10, * @ref GL::TextureFormat::CompressedRGBAAstc12x10; - * @val_vk_keyword{FORMAT_ASTC_12x10_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc12x10RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_12x10_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_12x10_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_12x10_HDR} @@ -1681,7 +1670,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc12x12, * @ref GL::TextureFormat::CompressedRGBAAstc12x12; - * @val_vk_keyword{FORMAT_ASTC_12x12_UNORM_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc12x12RGBAUnorm or * @m_class{m-doc-external} [MTLPixelFormatASTC_12x12_LDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_12x12_ldr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_12x12_LDR} @@ -1696,7 +1685,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::SRGB8Alpha8Astc12x12, * @ref GL::TextureFormat::CompressedSRGB8Alpha8Astc12x12; - * @val_vk_keyword{FORMAT_ASTC_12x12_SRGB_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc12x12RGBASrgb or * @m_class{m-doc-external} [MTLPixelFormatASTC_12x12_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_12x12_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_12x12_sRGB} @@ -1710,7 +1699,7 @@ enum class CompressedPixelFormat: UnsignedInt { * * Corresponds to @ref GL::CompressedPixelFormat::RGBAAstc12x12, * @ref GL::TextureFormat::CompressedRGBAAstc12x12; - * @val_vk_keyword{FORMAT_ASTC_12x12_SFLOAT_BLOCK,Format} or + * @ref Vk::PixelFormat::CompressedAstc12x12RGBAF or * @m_class{m-doc-external} [MTLPixelFormatASTC_12x12_HDR](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatastc_12x12_hdr?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatASTC_12x12_HDR} @@ -2126,8 +2115,8 @@ enum class CompressedPixelFormat: UnsignedInt { * unsigned byte with 2 bits per pixel. * * Corresponds to @ref GL::CompressedPixelFormat::RGBPvrtc2bppV1, - * @ref GL::TextureFormat::CompressedRGBPvrtc2bppV1 / - * @val_vk_keyword{FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG,Format} or + * @ref GL::TextureFormat::CompressedRGBPvrtc2bppV1; + * @ref Vk::PixelFormat::CompressedPvrtcRGBA2bppUnorm or * @m_class{m-doc-external} [MTLPixelFormatPVRTC_RGB_2BPP](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatpvrtc_rgb_2bpp?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatPVRTC_RGB_2BPP} @@ -2140,8 +2129,8 @@ enum class CompressedPixelFormat: UnsignedInt { * unsigned byte with 2 bits per pixel. * * Corresponds to @ref GL::CompressedPixelFormat::SRGBPvrtc2bppV1, - * @ref GL::TextureFormat::CompressedSRGBPvrtc2bppV1 / - * @val_vk_keyword{FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG,Format} or + * @ref GL::TextureFormat::CompressedSRGBPvrtc2bppV1; + * @ref Vk::PixelFormat::CompressedPvrtcRGBA2bppSrgb or * @m_class{m-doc-external} [MTLPixelFormatPVRTC_RGB_2BPP_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatpvrtc_rgb_2bpp_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatPVRTC_RGB_2BPP_sRGB} @@ -2154,8 +2143,8 @@ enum class CompressedPixelFormat: UnsignedInt { * unsigned byte with 2 bits per pixel. * * Corresponds to @ref GL::CompressedPixelFormat::RGBAPvrtc2bppV1, - * @ref GL::TextureFormat::CompressedRGBAPvrtc2bppV1 / - * @val_vk_keyword{FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG,Format} or + * @ref GL::TextureFormat::CompressedRGBAPvrtc2bppV1; + * @ref Vk::PixelFormat::CompressedPvrtcRGBA2bppUnorm or * @m_class{m-doc-external} [MTLPixelFormatPVRTC_RGBA_2BPP](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatpvrtc_rgba_2bpp?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatPVRTC_RGBA_2BPP} @@ -2168,8 +2157,8 @@ enum class CompressedPixelFormat: UnsignedInt { * alpha, normalized unsigned byte with 2 bits per pixel. * * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaPvrtc2bppV1, - * @ref GL::TextureFormat::CompressedSRGBAlphaPvrtc2bppV1 / - * @val_vk_keyword{FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG,Format} or + * @ref GL::TextureFormat::CompressedSRGBAlphaPvrtc2bppV1; + * @ref Vk::PixelFormat::CompressedPvrtcRGBA2bppSrgb or * @m_class{m-doc-external} [MTLPixelFormatPVRTC_RGBA_2BPP_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatpvrtc_rgba_2bpp_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatPVRTC_RGBA_2BPP_sRGB} @@ -2182,8 +2171,8 @@ enum class CompressedPixelFormat: UnsignedInt { * unsigned byte with 4 bits per pixel. * * Corresponds to @ref GL::CompressedPixelFormat::RGBPvrtc4bppV1, - * @ref GL::TextureFormat::CompressedRGBPvrtc4bppV1 / - * @val_vk_keyword{FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG,Format} or + * @ref GL::TextureFormat::CompressedRGBPvrtc4bppV1; + * @ref Vk::PixelFormat::CompressedPvrtcRGBA4bppUnorm or * @m_class{m-doc-external} [MTLPixelFormatPVRTC_RGB_4BPP](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatpvrtc_rgb_4bpp?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatPVRTC_RGB_4BPP} @@ -2196,8 +2185,8 @@ enum class CompressedPixelFormat: UnsignedInt { * unsigned byte with 4 bits per pixel. * * Corresponds to @ref GL::CompressedPixelFormat::SRGBPvrtc4bppV1, - * @ref GL::TextureFormat::CompressedSRGBPvrtc4bppV1 / - * @val_vk_keyword{FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG,Format} or + * @ref GL::TextureFormat::CompressedSRGBPvrtc4bppV1; + * @ref Vk::PixelFormat::CompressedPvrtcRGBA4bppSrgb or * @m_class{m-doc-external} [MTLPixelFormatPVRTC_RGB_4BPP_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatpvrtc_rgb_4bpp_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatPVRTC_RGB_4BPP_sRGB} @@ -2210,8 +2199,8 @@ enum class CompressedPixelFormat: UnsignedInt { * unsigned byte with 4 bits per pixel. * * Corresponds to @ref GL::CompressedPixelFormat::RGBAPvrtc4bppV1, - * @ref GL::TextureFormat::CompressedRGBAPvrtc4bppV1 / - * @val_vk_keyword{FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG,Format} or + * @ref GL::TextureFormat::CompressedRGBAPvrtc4bppV1; + * @ref Vk::PixelFormat::CompressedPvrtcRGBA4bppUnorm or * @m_class{m-doc-external} [MTLPixelFormatPVRTC_RGBA_4BPP](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatpvrtc_rgba_4bpp?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatPVRTC_RGBA_4BPP} @@ -2224,8 +2213,8 @@ enum class CompressedPixelFormat: UnsignedInt { * alpha, normalized unsigned byte with 4 bits per pixel. * * Corresponds to @ref GL::CompressedPixelFormat::SRGBAlphaPvrtc4bppV1, - * @ref GL::TextureFormat::CompressedSRGBAlphaPvrtc4bppV1 / - * @val_vk_keyword{FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG,Format} or + * @ref GL::TextureFormat::CompressedSRGBAlphaPvrtc4bppV1; + * @ref Vk::PixelFormat::CompressedPvrtcRGBA4bppUnorm or * @m_class{m-doc-external} [MTLPixelFormatPVRTC_RGBA_4BPP_sRGB](https://developer.apple.com/documentation/metal/mtlpixelformat/mtlpixelformatpvrtc_rgba_4bpp_srgb?language=objc). * No equivalent in D3D. * @m_keywords{MTLPixelFormatPVRTC_RGBA_4BPP_sRGB} diff --git a/src/Magnum/Vk/CMakeLists.txt b/src/Magnum/Vk/CMakeLists.txt index c6ef27cb4..cc8813239 100644 --- a/src/Magnum/Vk/CMakeLists.txt +++ b/src/Magnum/Vk/CMakeLists.txt @@ -54,6 +54,7 @@ set(MagnumVk_GracefulAssert_SRCS Instance.cpp LayerProperties.cpp Memory.cpp + PixelFormat.cpp RenderPass.cpp) set(MagnumVk_HEADERS diff --git a/src/Magnum/Vk/DeviceFeatures.h b/src/Magnum/Vk/DeviceFeatures.h index 3ac3756e8..0c782bf34 100644 --- a/src/Magnum/Vk/DeviceFeatures.h +++ b/src/Magnum/Vk/DeviceFeatures.h @@ -132,21 +132,80 @@ enum class DeviceFeature: UnsignedShort { SamplerAnisotropy, /** - * Whether *all* ETC2 and EAC compressed texture formats are supported. - * @todoc link to the formats once we have our own PixelFormat enum + * Whether @ref PixelFormat::CompressedEacR11Unorm, + * @ref PixelFormat::CompressedEacR11Snorm, + * @ref PixelFormat::CompressedEacRG11Unorm, + * @ref PixelFormat::CompressedEacRG11Snorm, + * @ref PixelFormat::CompressedEtc2RGB8Unorm, + * @ref PixelFormat::CompressedEtc2RGB8Srgb, + * @ref PixelFormat::CompressedEtc2RGB8A1Unorm, + * @ref PixelFormat::CompressedEtc2RGB8A1Srgb, + * @ref PixelFormat::CompressedEtc2RGBA8Unorm, + * @ref PixelFormat::CompressedEtc2RGBA8Unorm ETC2 and EAC compressed + * texture formats are *all* supported. + * @see @ref DeviceFeature::TextureCompressionBc, + * @ref DeviceFeature::TextureCompressionAstcLdr, + * @ref DeviceFeature::TextureCompressionAstcHdr */ TextureCompressionEtc2, /** - * Whether *all* ASTC LDR compressed texture formats are supported. - * @todoc link to the formats once we have our own PixelFormat enum - * @see @ref DeviceFeature::TextureCompressionAstcHdr + * Whether @ref PixelFormat::CompressedAstc4x4RGBAUnorm, + * @ref PixelFormat::CompressedAstc4x4RGBASrgb, + * @ref PixelFormat::CompressedAstc5x4RGBAUnorm, + * @ref PixelFormat::CompressedAstc5x4RGBASrgb, + * @ref PixelFormat::CompressedAstc5x5RGBAUnorm, + * @ref PixelFormat::CompressedAstc5x5RGBASrgb, + * @ref PixelFormat::CompressedAstc6x5RGBAUnorm, + * @ref PixelFormat::CompressedAstc6x5RGBASrgb, + * @ref PixelFormat::CompressedAstc6x6RGBAUnorm, + * @ref PixelFormat::CompressedAstc6x6RGBASrgb, + * @ref PixelFormat::CompressedAstc8x5RGBAUnorm, + * @ref PixelFormat::CompressedAstc8x5RGBASrgb, + * @ref PixelFormat::CompressedAstc8x6RGBAUnorm, + * @ref PixelFormat::CompressedAstc8x6RGBASrgb, + * @ref PixelFormat::CompressedAstc8x8RGBAUnorm, + * @ref PixelFormat::CompressedAstc8x8RGBASrgb, + * @ref PixelFormat::CompressedAstc10x5RGBAUnorm, + * @ref PixelFormat::CompressedAstc10x5RGBASrgb, + * @ref PixelFormat::CompressedAstc10x6RGBAUnorm, + * @ref PixelFormat::CompressedAstc10x6RGBASrgb, + * @ref PixelFormat::CompressedAstc10x8RGBAUnorm, + * @ref PixelFormat::CompressedAstc10x8RGBASrgb, + * @ref PixelFormat::CompressedAstc10x10RGBAUnorm, + * @ref PixelFormat::CompressedAstc10x10RGBASrgb, + * @ref PixelFormat::CompressedAstc12x10RGBAUnorm, + * @ref PixelFormat::CompressedAstc12x10RGBASrgb, + * @ref PixelFormat::CompressedAstc12x12RGBAUnorm, + * @ref PixelFormat::CompressedAstc12x12RGBASrgb, + * ASTC LDR compressed texture formats are *all* supported. + * @see @ref DeviceFeature::TextureCompressionAstcHdr, + * @ref DeviceFeature::TextureCompressionEtc2, + * @ref DeviceFeature::TextureCompressionBc */ TextureCompressionAstcLdr, /** - * Whether *all* BC compressed texture formats are supported. - * @todoc link to the formats once we have our own PixelFormat enum + * Whether @ref PixelFormat::CompressedBc1RGBUnorm, + * @ref PixelFormat::CompressedBc1RGBSrgb, + * @ref PixelFormat::CompressedBc1RGBAUnorm, + * @ref PixelFormat::CompressedBc1RGBASrgb, + * @ref PixelFormat::CompressedBc2RGBAUnorm, + * @ref PixelFormat::CompressedBc2RGBASrgb, + * @ref PixelFormat::CompressedBc3RGBAUnorm, + * @ref PixelFormat::CompressedBc3RGBASrgb, + * @ref PixelFormat::CompressedBc4RUnorm, + * @ref PixelFormat::CompressedBc4RSnorm, + * @ref PixelFormat::CompressedBc5RGUnorm, + * @ref PixelFormat::CompressedBc5RGSnorm, + * @ref PixelFormat::CompressedBc6hRGBUfloat, + * @ref PixelFormat::CompressedBc6hRGBSfloat, + * @ref PixelFormat::CompressedBc7RGBAUnorm, + * @ref PixelFormat::CompressedBc7RGBASrgb BC compressed texture formats + * are *all* supported. + * @see @ref DeviceFeature::TextureCompressionEtc2, + * @ref DeviceFeature::TextureCompressionAstcLdr, + * @ref DeviceFeature::TextureCompressionAstcHdr */ TextureCompressionBc, @@ -438,9 +497,24 @@ enum class DeviceFeature: UnsignedShort { /* VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT, #67 */ /** - * Whether *all* ASTC HDR compressed texture formats are supported. - * @todoc link to the formats once we have our own PixelFormat enum - * @see @ref DeviceFeature::TextureCompressionAstcLdr + * Whether @ref PixelFormat::CompressedAstc4x4RGBAF, + * @ref PixelFormat::CompressedAstc5x4RGBAF, + * @ref PixelFormat::CompressedAstc5x5RGBAF, + * @ref PixelFormat::CompressedAstc6x5RGBAF, + * @ref PixelFormat::CompressedAstc6x6RGBAF, + * @ref PixelFormat::CompressedAstc8x5RGBAF, + * @ref PixelFormat::CompressedAstc8x6RGBAF, + * @ref PixelFormat::CompressedAstc8x8RGBAF, + * @ref PixelFormat::CompressedAstc10x5RGBAF, + * @ref PixelFormat::CompressedAstc10x6RGBAF, + * @ref PixelFormat::CompressedAstc10x8RGBAF, + * @ref PixelFormat::CompressedAstc10x10RGBAF, + * @ref PixelFormat::CompressedAstc12x10RGBAF, + * @ref PixelFormat::CompressedAstc12x12RGBAF ASTC HDR compressed + * texture formats are *all* supported. + * @see @ref DeviceFeature::TextureCompressionAstcLdr, + * @ref DeviceFeature::TextureCompressionEtc2, + * @ref DeviceFeature::TextureCompressionBc * @requires_vk_extension Extension @vk_extension{EXT,texture_compression_astc_hdr} */ TextureCompressionAstcHdr, diff --git a/src/Magnum/Vk/Enums.cpp b/src/Magnum/Vk/Enums.cpp index f99455899..5dc95581a 100644 --- a/src/Magnum/Vk/Enums.cpp +++ b/src/Magnum/Vk/Enums.cpp @@ -28,10 +28,13 @@ #include #include "Magnum/Mesh.h" -#include "Magnum/PixelFormat.h" #include "Magnum/Sampler.h" #include "Magnum/VertexFormat.h" +#ifdef MAGNUM_BUILD_DEPRECATED +#include "Magnum/Vk/PixelFormat.h" +#endif + namespace Magnum { namespace Vk { namespace { @@ -66,24 +69,6 @@ constexpr VkFormat VertexFormatMapping[] { #undef _s #undef _c }; - -constexpr VkFormat PixelFormatMapping[] { - /* GCC 4.8 doesn't like just a {} for default enum values */ - #define _c(input, format) VK_FORMAT_ ## format, - #define _s(input) VkFormat{}, - #include "Magnum/Vk/Implementation/pixelFormatMapping.hpp" - #undef _s - #undef _c -}; - -constexpr VkFormat CompressedPixelFormatMapping[] { - /* GCC 4.8 doesn't like just a {} for default enum values */ - #define _c(input, format) VK_FORMAT_ ## format, - #define _s(input) VkFormat{}, - #include "Magnum/Vk/Implementation/compressedPixelFormatMapping.hpp" - #undef _s - #undef _c -}; #endif constexpr VkFilter FilterMapping[]{ @@ -152,23 +137,15 @@ bool hasVkFormat(const Magnum::VertexFormat format) { return UnsignedInt(VertexFormatMapping[UnsignedInt(format) - 1]); } +#ifdef MAGNUM_BUILD_DEPRECATED bool hasVkFormat(const Magnum::PixelFormat format) { - if(isPixelFormatImplementationSpecific(format)) - return true; - - CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(PixelFormatMapping), - "Vk::hasVkFormat(): invalid format" << format, {}); - return UnsignedInt(PixelFormatMapping[UnsignedInt(format) - 1]); + return hasPixelFormat(format); } bool hasVkFormat(const Magnum::CompressedPixelFormat format) { - if(isCompressedPixelFormatImplementationSpecific(format)) - return true; - - CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(CompressedPixelFormatMapping), - "Vk::hasVkFormat(): invalid format" << format, {}); - return UnsignedInt(CompressedPixelFormatMapping[UnsignedInt(format) - 1]); + return hasPixelFormat(format); } +#endif VkFormat vkFormat(const Magnum::VertexFormat format) { if(isVertexFormatImplementationSpecific(format)) @@ -182,29 +159,15 @@ VkFormat vkFormat(const Magnum::VertexFormat format) { return out; } +#ifdef MAGNUM_BUILD_DEPRECATED VkFormat vkFormat(const Magnum::PixelFormat format) { - if(isPixelFormatImplementationSpecific(format)) - return pixelFormatUnwrap(format); - - CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(PixelFormatMapping), - "Vk::vkFormat(): invalid format" << format, {}); - const VkFormat out = PixelFormatMapping[UnsignedInt(format) - 1]; - CORRADE_ASSERT(UnsignedInt(out), - "Vk::vkFormat(): unsupported format" << format, {}); - return out; + return VkFormat(pixelFormat(format)); } VkFormat vkFormat(const Magnum::CompressedPixelFormat format) { - if(isCompressedPixelFormatImplementationSpecific(format)) - return compressedPixelFormatUnwrap(format); - - CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(CompressedPixelFormatMapping), - "Vk::vkFormat(): invalid format" << format, {}); - const VkFormat out = CompressedPixelFormatMapping[UnsignedInt(format) - 1]; - CORRADE_ASSERT(UnsignedInt(out), - "Vk::vkFormat(): unsupported format" << format, {}); - return out; + return VkFormat(pixelFormat(format)); } +#endif VkFilter vkFilter(const Magnum::SamplerFilter filter) { CORRADE_ASSERT(UnsignedInt(filter) < Containers::arraySize(FilterMapping), diff --git a/src/Magnum/Vk/Enums.h b/src/Magnum/Vk/Enums.h index b774fdcd3..0ad09bebe 100644 --- a/src/Magnum/Vk/Enums.h +++ b/src/Magnum/Vk/Enums.h @@ -33,6 +33,10 @@ #include "Magnum/Vk/Vulkan.h" #include "Magnum/Vk/visibility.h" +#ifdef MAGNUM_BUILD_DEPRECATED +#include +#endif + namespace Magnum { namespace Vk { /** @@ -107,37 +111,21 @@ vectors to consecutive attribute locations based on what */ MAGNUM_VK_EXPORT bool hasVkFormat(Magnum::VertexFormat format); +#ifdef MAGNUM_BUILD_DEPRECATED /** -@brief Check availability of a generic pixel format - -Returns @cpp false @ce if Vulkan doesn't support such format, @cpp true @ce -otherwise. Moreover, returns @cpp true @ce also for all formats that are -@ref isPixelFormatImplementationSpecific(). The @p format value is expected to -be valid. - -@note Support of some formats depends on presence of a particular Vulkan - extension. Such check is outside of the scope of this function and you are - expected to verify extension availability before using such format. - -@see @ref vkFormat(Magnum::PixelFormat) -*/ -MAGNUM_VK_EXPORT bool hasVkFormat(Magnum::PixelFormat format); + * @brief @copybrief hasPixelFormat(Magnum::PixelFormat) + * @m_deprecated_since_latest Use @ref hasPixelFormat(Magnum::PixelFormat) + * instead. + */ +CORRADE_DEPRECATED("use hasPixelFormat() instead") MAGNUM_VK_EXPORT bool hasVkFormat(Magnum::PixelFormat format); /** -@brief Check availability of a generic compressed pixel format - -Returns @cpp false @ce if Vulkan doesn't support such format, @cpp true @ce -otherwise. Moreover, returns @cpp true @ce also for all formats that are -@ref isCompressedPixelFormatImplementationSpecific(). The @p format value is -expected to be valid. - -@note Support of some formats depends on presence of a particular Vulkan - extension. Such check is outside of the scope of this function and you are - expected to verify extension availability before using such format. - -@see @ref vkFormat(Magnum::CompressedPixelFormat) -*/ -MAGNUM_VK_EXPORT bool hasVkFormat(Magnum::CompressedPixelFormat format); + * @brief @copybrief hasPixelFormat(Magnum::CompressedPixelFormat) + * @m_deprecated_since_latest Use @ref hasPixelFormat(Magnum::CompressedPixelFormat) + * instead. + */ +CORRADE_DEPRECATED("use hasPixelFormat() instead") MAGNUM_VK_EXPORT bool hasVkFormat(Magnum::CompressedPixelFormat format); +#endif /** @brief Convert a generic vertex format to Vulkan format @@ -155,36 +143,21 @@ to query availability of given format. */ MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::VertexFormat format); +#ifdef MAGNUM_BUILD_DEPRECATED /** -@brief Convert a generic pixel format to Vulkan format - -In case @ref isPixelFormatImplementationSpecific() returns @cpp false @ce for -@p format, maps it to a corresponding Vulkan format. In case -@ref isPixelFormatImplementationSpecific() returns @cpp true @ce, assumes -@p format stores a Vulkan-specific format and returns @ref pixelFormatUnwrap() -cast to @type_vk{Format}. - -Not all generic pixel formats have a Vulkan equivalent and this function -expects that given format is available. Use @ref hasVkFormat(Magnum::PixelFormat) -to query availability of given format. -*/ -MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::PixelFormat format); + * @brief @copybrief pixelFormat(Magnum::PixelFormat) + * @m_deprecated_since_latest Use @ref pixelFormat(Magnum::PixelFormat) + * instead. + */ +CORRADE_DEPRECATED("use pixelFormat() instead") MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::PixelFormat format); /** -@brief Convert a generic pixel format to Vulkan format - -In case @ref isCompressedPixelFormatImplementationSpecific() returns -@cpp false @ce for @p format, maps it to a corresponding Vulkan format. In case -@ref isCompressedPixelFormatImplementationSpecific() returns @cpp true @ce, -assumes @p format stores a Vulkan-specific format and returns -@ref compressedPixelFormatUnwrap() cast to @type_vk{Format}. - -Not all generic pixel formats have a Vulkan equivalent and this function -expects that given format is available. Use -@ref hasVkFormat(Magnum::CompressedPixelFormat) to query availability of given -format. -*/ -MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::CompressedPixelFormat format); + * @brief @copybrief pixelFormat(Magnum::CompressedPixelFormat) + * @m_deprecated_since_latest Use @ref pixelFormat(Magnum::CompressedPixelFormat) + * instead. + */ +CORRADE_DEPRECATED("use pixelFormat() instead") MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::CompressedPixelFormat format); +#endif /** @brief Convert generic sampler filter to Vulkan filter diff --git a/src/Magnum/Vk/Image.cpp b/src/Magnum/Vk/Image.cpp index a616c9097..6d0ed3e64 100644 --- a/src/Magnum/Vk/Image.cpp +++ b/src/Magnum/Vk/Image.cpp @@ -32,15 +32,16 @@ #include "Magnum/Vk/Handle.h" #include "Magnum/Vk/Integration.h" #include "Magnum/Vk/MemoryAllocateInfo.h" +#include "Magnum/Vk/PixelFormat.h" #include "Magnum/Vk/Implementation/DeviceState.h" namespace Magnum { namespace Vk { -ImageCreateInfo::ImageCreateInfo(const VkImageType type, const ImageUsages usages, const VkFormat format, const Vector3i& size, const Int layers, const Int levels, const Int samples, const ImageLayout initialLayout, const Flags flags): _info{} { +ImageCreateInfo::ImageCreateInfo(const VkImageType type, const ImageUsages usages, const PixelFormat format, const Vector3i& size, const Int layers, const Int levels, const Int samples, const ImageLayout initialLayout, const Flags flags): _info{} { _info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; _info.flags = VkImageCreateFlags(flags); _info.imageType = type; - _info.format = format; + _info.format = VkFormat(format); _info.extent = VkExtent3D(size); _info.mipLevels = levels; _info.arrayLayers = layers; @@ -53,6 +54,10 @@ ImageCreateInfo::ImageCreateInfo(const VkImageType type, const ImageUsages usage _info.initialLayout = VkImageLayout(initialLayout); } +ImageCreateInfo::ImageCreateInfo(const VkImageType type, const ImageUsages usages, const Magnum::PixelFormat format, const Vector3i& size, const Int layers, const Int levels, const Int samples, const ImageLayout initialLayout, const Flags flags): ImageCreateInfo{type, usages, pixelFormat(format), size, layers, levels, samples, initialLayout, flags} {} + +ImageCreateInfo::ImageCreateInfo(const VkImageType type, const ImageUsages usages, const Magnum::CompressedPixelFormat format, const Vector3i& size, const Int layers, const Int levels, const Int samples, const ImageLayout initialLayout, const Flags flags): ImageCreateInfo{type, usages, pixelFormat(format), size, layers, levels, samples, initialLayout, flags} {} + ImageCreateInfo::ImageCreateInfo(NoInitT) noexcept {} ImageCreateInfo::ImageCreateInfo(const VkImageCreateInfo& info): @@ -60,7 +65,7 @@ ImageCreateInfo::ImageCreateInfo(const VkImageCreateInfo& info): member instead of doing a copy */ _info(info) {} -Image Image::wrap(Device& device, const VkImage handle, const VkFormat format, const HandleFlags flags) { +Image Image::wrap(Device& device, const VkImage handle, const PixelFormat format, const HandleFlags flags) { Image out{NoCreate}; out._device = &device; out._handle = handle; @@ -69,7 +74,15 @@ Image Image::wrap(Device& device, const VkImage handle, const VkFormat format, c return out; } -Image::Image(Device& device, const ImageCreateInfo& info, NoAllocateT): _device{&device}, _flags{HandleFlag::DestroyOnDestruction}, _format{info->format}, _dedicatedMemory{NoCreate} { +Image Image::wrap(Device& device, const VkImage handle, const Magnum::PixelFormat format, const HandleFlags flags) { + return wrap(device, handle, pixelFormat(format), flags); +} + +Image Image::wrap(Device& device, const VkImage handle, const Magnum::CompressedPixelFormat format, const HandleFlags flags) { + return wrap(device, handle, pixelFormat(format), flags); +} + +Image::Image(Device& device, const ImageCreateInfo& info, NoAllocateT): _device{&device}, _flags{HandleFlag::DestroyOnDestruction}, _format{PixelFormat(info->format)}, _dedicatedMemory{NoCreate} { MAGNUM_VK_INTERNAL_ASSERT_SUCCESS(device->CreateImage(device, info, nullptr, &_handle)); } diff --git a/src/Magnum/Vk/Image.h b/src/Magnum/Vk/Image.h index 2357bb8f6..9f985ae37 100644 --- a/src/Magnum/Vk/Image.h +++ b/src/Magnum/Vk/Image.h @@ -198,16 +198,20 @@ class MAGNUM_VK_EXPORT Image { * * The @p handle is expected to be originating from @p device. The * @p format parameter is used for convenience @ref ImageView creation. - * If it's unknown, use @val_vk{FORMAT_UNDEFINED,Format} --- you will - * then be able to only create image views by passing a concrete format - * to @ref ImageViewCreateInfo. + * If it's unknown, use a @cpp PixelFormat{} @ce --- you will then be + * able to only create image views by passing a concrete format to + * @ref ImageViewCreateInfo. * * Unlike an image created using a constructor, the Vulkan image is by * default not deleted on destruction, use @p flags for different * behavior. * @see @ref release() */ - static Image wrap(Device& device, VkImage handle, VkFormat format, HandleFlags flags = {}); + static Image wrap(Device& device, VkImage handle, PixelFormat format, HandleFlags flags = {}); + /** @overload */ + static Image wrap(Device& device, VkImage handle, Magnum::PixelFormat format, HandleFlags flags = {}); + /** @overload */ + static Image wrap(Device& device, VkImage handle, Magnum::CompressedPixelFormat format, HandleFlags flags = {}); /** * @brief Construct an image without allocating @@ -276,7 +280,7 @@ class MAGNUM_VK_EXPORT Image { HandleFlags handleFlags() const { return _flags; } /** @brief Image format */ - VkFormat format() const { return _format; } + PixelFormat format() const { return _format; } /** * @brief Image memory requirements @@ -360,7 +364,7 @@ class MAGNUM_VK_EXPORT Image { involved and not safe to rely on (e.g., implicit view type would be 2D_ARRAY if there's more than one layer and then if you'd use just one layer it suddenly becomes just 2D, breaking everything). */ - VkFormat _format; + PixelFormat _format; Memory _dedicatedMemory; }; diff --git a/src/Magnum/Vk/ImageCreateInfo.h b/src/Magnum/Vk/ImageCreateInfo.h index 3705851cc..877c1a8c6 100644 --- a/src/Magnum/Vk/ImageCreateInfo.h +++ b/src/Magnum/Vk/ImageCreateInfo.h @@ -70,18 +70,28 @@ enum class ImageUsage: UnsignedInt { TransferDestination = VK_IMAGE_USAGE_TRANSFER_DST_BIT, /** - * Sampled by a shader + * Sampled by a shader. * + * Not all pixel formats support sampling, see @ref PixelFormat for more + * information. * @see @ref ImageLayout::ShaderReadOnly */ Sampled = VK_IMAGE_USAGE_SAMPLED_BIT, - /** Shader storage */ + /** + * Shader storage. + * + * Not all pixel formats support shader storage, with some requiring the + * @ref DeviceFeature::ShaderStorageImageExtendedFormats feature. See + * @ref PixelFormat for more information. + */ Storage = VK_IMAGE_USAGE_STORAGE_BIT, /** * Color attachment * + * Not all pixel formats support color attachment, see @ref PixelFormat for + * more information. * @see @ref ImageLayout::ColorAttachment */ ColorAttachment = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -89,6 +99,10 @@ enum class ImageUsage: UnsignedInt { /** * Depth/stencil attachment * + * Note that only one of @ref PixelFormat::Depth24Unorm / + * @ref PixelFormat::Depth32F and @ref PixelFormat::Depth24UnormStencil8UI + * / @ref PixelFormat::Depth32FStencil8UI is guaranteed to support + * depth/stencil attachment. * @see @ref ImageLayout::DepthStencilAttachment */ DepthStencilAttachment = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -131,7 +145,7 @@ class MAGNUM_VK_EXPORT ImageCreateInfo { * @brief Image creation flag * * Wraps @type_vk_keyword{ImageCreateFlagBits}. - * @see @ref Flags, @ref ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) + * @see @ref Flags, @ref ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) * @m_enum_values_as_keywords */ enum class Flag: UnsignedInt { @@ -154,7 +168,7 @@ class MAGNUM_VK_EXPORT ImageCreateInfo { * @brief Image creation flags * * Type-safe wrapper for @type_vk_keyword{ImageCreateFlags}. - * @see @ref ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) + * @see @ref ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) */ typedef Containers::EnumSet Flags; @@ -196,7 +210,12 @@ class MAGNUM_VK_EXPORT ImageCreateInfo { * @ref ImageCreateInfoCubeMapArray convenience classes instead of * this constructor. */ - explicit ImageCreateInfo(VkImageType type, ImageUsages usages, VkFormat format, const Vector3i& size, Int layers, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}); + explicit ImageCreateInfo(VkImageType type, ImageUsages usages, PixelFormat format, const Vector3i& size, Int layers, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}); + /** @overload */ + explicit ImageCreateInfo(VkImageType type, ImageUsages usages, Magnum::PixelFormat format, const Vector3i& size, Int layers, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}); + /** @overload */ + explicit ImageCreateInfo(VkImageType type, ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector3i& size, Int layers, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}); + /* No overload w/o initialLayout here as the general public is expected to use the convenience classes anyway */ @@ -245,20 +264,28 @@ Compared to the base @ref ImageCreateInfo constructor creates an image of type to have only one layer. Note that same as with the -@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) +@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) constructor, at least one @ref ImageUsage value is required. */ class ImageCreateInfo1D: public ImageCreateInfo { public: /** @brief Constructor */ - explicit ImageCreateInfo1D(ImageUsages usages, VkFormat format, Int size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_1D, usages, format, {size, 1, 1}, 1, levels, samples, initialLayout, flags} {} + explicit ImageCreateInfo1D(ImageUsages usages, PixelFormat format, Int size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_1D, usages, format, {size, 1, 1}, 1, levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo1D(ImageUsages usages, Magnum::PixelFormat format, Int size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_1D, usages, format, {size, 1, 1}, 1, levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo1D(ImageUsages usages, Magnum::CompressedPixelFormat format, Int size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_1D, usages, format, {size, 1, 1}, 1, levels, samples, initialLayout, flags} {} /** @overload * * Equivalent to the above with @p initialLayout set to * @ref ImageLayout::Undefined. */ - explicit ImageCreateInfo1D(ImageUsages usages, VkFormat format, Int size, Int levels, Int samples, Flags flags): ImageCreateInfo1D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + explicit ImageCreateInfo1D(ImageUsages usages, PixelFormat format, Int size, Int levels, Int samples, Flags flags): ImageCreateInfo1D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo1D(ImageUsages usages, Magnum::PixelFormat format, Int size, Int levels, Int samples, Flags flags): ImageCreateInfo1D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo1D(ImageUsages usages, Magnum::CompressedPixelFormat format, Int size, Int levels, Int samples, Flags flags): ImageCreateInfo1D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} }; /** @@ -272,20 +299,28 @@ set to @cpp 1 @ce. You can use both @ref ImageViewCreateInfo2D and to have only one layer. Note that same as with the -@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) +@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) constructor, at least one @ref ImageUsage value is required. */ class ImageCreateInfo2D: public ImageCreateInfo { public: /** @brief Constructor */ - explicit ImageCreateInfo2D(ImageUsages usages, VkFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size, 1}, 1, levels, samples, initialLayout, flags} {} + explicit ImageCreateInfo2D(ImageUsages usages, PixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size, 1}, 1, levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo2D(ImageUsages usages, Magnum::PixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size, 1}, 1, levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo2D(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size, 1}, 1, levels, samples, initialLayout, flags} {} /** @overload * * Equivalent to the above with @p initialLayout set to * @ref ImageLayout::Undefined. */ - explicit ImageCreateInfo2D(ImageUsages usages, VkFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfo2D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + explicit ImageCreateInfo2D(ImageUsages usages, PixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfo2D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo2D(ImageUsages usages, Magnum::PixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfo2D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo2D(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfo2D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} }; /** @@ -297,20 +332,28 @@ Compared to the base @ref ImageCreateInfo constructor creates an image of type @ref ImageViewCreateInfo3D for view creation. Note that same as with the -@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) +@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) constructor, at least one @ref ImageUsage value is required. */ class ImageCreateInfo3D: public ImageCreateInfo { public: /** @brief Constructor */ - explicit ImageCreateInfo3D(ImageUsages usages, VkFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_3D, usages, format, size, 1, levels, samples, initialLayout, flags} {} + explicit ImageCreateInfo3D(ImageUsages usages, PixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_3D, usages, format, size, 1, levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo3D(ImageUsages usages, Magnum::PixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_3D, usages, format, size, 1, levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo3D(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_3D, usages, format, size, 1, levels, samples, initialLayout, flags} {} /** @overload * * Equivalent to the above with @p initialLayout set to * @ref ImageLayout::Undefined. */ - explicit ImageCreateInfo3D(ImageUsages usages, VkFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfo3D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + explicit ImageCreateInfo3D(ImageUsages usages, PixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfo3D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo3D(ImageUsages usages, Magnum::PixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfo3D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo3D(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfo3D{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} }; /** @@ -324,20 +367,28 @@ Compared to the base @ref ImageCreateInfo constructor creates an image of type creation. Note that same as with the -@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) +@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) constructor, at least one @ref ImageUsage value is required. */ class ImageCreateInfo1DArray: public ImageCreateInfo { public: /** @brief Constructor */ - explicit ImageCreateInfo1DArray(ImageUsages usages, VkFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_1D, usages, format, {size.x(), 1, 1}, size.y(), levels, samples, initialLayout, flags} {} + explicit ImageCreateInfo1DArray(ImageUsages usages, PixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_1D, usages, format, {size.x(), 1, 1}, size.y(), levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo1DArray(ImageUsages usages, Magnum::PixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_1D, usages, format, {size.x(), 1, 1}, size.y(), levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo1DArray(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_1D, usages, format, {size.x(), 1, 1}, size.y(), levels, samples, initialLayout, flags} {} /** @overload * * Equivalent to the above with @p initialLayout set to * @ref ImageLayout::Undefined. */ - explicit ImageCreateInfo1DArray(ImageUsages usages, VkFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfo1DArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + explicit ImageCreateInfo1DArray(ImageUsages usages, PixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfo1DArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo1DArray(ImageUsages usages, Magnum::PixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfo1DArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo1DArray(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfo1DArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} }; /** @@ -353,20 +404,28 @@ well, although in that case it's better to use @ref ImageCreateInfoCubeMap that does this automatically. Note that same as with the -@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) +@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) constructor, at least one @ref ImageUsage value is required. */ class ImageCreateInfo2DArray: public ImageCreateInfo { public: /** @brief Constructor */ - explicit ImageCreateInfo2DArray(ImageUsages usages, VkFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size.xy(), 1}, size.z(), levels, samples, initialLayout, flags} {} + explicit ImageCreateInfo2DArray(ImageUsages usages, PixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size.xy(), 1}, size.z(), levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo2DArray(ImageUsages usages, Magnum::PixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size.xy(), 1}, size.z(), levels, samples, initialLayout, flags} {} + /** @overload */ + explicit ImageCreateInfo2DArray(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size.xy(), 1}, size.z(), levels, samples, initialLayout, flags} {} /** @overload * * Equivalent to the above with @p initialLayout set to * @ref ImageLayout::Undefined. */ - explicit ImageCreateInfo2DArray(ImageUsages usages, VkFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfo2DArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + explicit ImageCreateInfo2DArray(ImageUsages usages, PixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfo2DArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo2DArray(ImageUsages usages, Magnum::PixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfo2DArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfo2DArray(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfo2DArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} }; /** @@ -383,20 +442,28 @@ will need to have exactly six layers, and requires @ref DeviceFeature::ImageCubeArray to be enabled. Note that same as with the -@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) +@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) constructor, at least one @ref ImageUsage value is required. */ class ImageCreateInfoCubeMap: public ImageCreateInfo { public: /** @brief Constructor */ - explicit ImageCreateInfoCubeMap(ImageUsages usages, VkFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size, 1}, 6, levels, samples, initialLayout, flags|Flag::CubeCompatible} {} + explicit ImageCreateInfoCubeMap(ImageUsages usages, PixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size, 1}, 6, levels, samples, initialLayout, flags|Flag::CubeCompatible} {} + /** @overload */ + explicit ImageCreateInfoCubeMap(ImageUsages usages, Magnum::PixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size, 1}, 6, levels, samples, initialLayout, flags|Flag::CubeCompatible} {} + /** @overload */ + explicit ImageCreateInfoCubeMap(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector2i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size, 1}, 6, levels, samples, initialLayout, flags|Flag::CubeCompatible} {} /** @overload * * Equivalent to the above with @p initialLayout set to * @ref ImageLayout::Undefined. */ - explicit ImageCreateInfoCubeMap(ImageUsages usages, VkFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfoCubeMap{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + explicit ImageCreateInfoCubeMap(ImageUsages usages, PixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfoCubeMap{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfoCubeMap(ImageUsages usages, Magnum::PixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfoCubeMap{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfoCubeMap(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector2i& size, Int levels, Int samples, Flags flags): ImageCreateInfoCubeMap{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} }; /** @@ -412,20 +479,28 @@ Compared to the base @ref ImageCreateInfo constructor creates an image of type requires @ref DeviceFeature::ImageCubeArray to be enabled. Note that same as with the -@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, VkFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) +@ref ImageCreateInfo::ImageCreateInfo(VkImageType, ImageUsages, PixelFormat, const Vector3i&, Int, Int, Int, ImageLayout, Flags) constructor, at least one @ref ImageUsage value is required. */ class ImageCreateInfoCubeMapArray: public ImageCreateInfo { public: /** @brief Constructor */ - explicit ImageCreateInfoCubeMapArray(ImageUsages usages, VkFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size.xy(), 1}, size.z(), levels, samples, initialLayout, flags|Flag::CubeCompatible} {} + explicit ImageCreateInfoCubeMapArray(ImageUsages usages, PixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size.xy(), 1}, size.z(), levels, samples, initialLayout, flags|Flag::CubeCompatible} {} + /** @overload */ + explicit ImageCreateInfoCubeMapArray(ImageUsages usages, Magnum::PixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size.xy(), 1}, size.z(), levels, samples, initialLayout, flags|Flag::CubeCompatible} {} + /** @overload */ + explicit ImageCreateInfoCubeMapArray(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector3i& size, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {}): ImageCreateInfo{VK_IMAGE_TYPE_2D, usages, format, {size.xy(), 1}, size.z(), levels, samples, initialLayout, flags|Flag::CubeCompatible} {} /** @overload * * Equivalent to the above with @p initialLayout set to * @ref ImageLayout::Undefined. */ - explicit ImageCreateInfoCubeMapArray(ImageUsages usages, VkFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfoCubeMapArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + explicit ImageCreateInfoCubeMapArray(ImageUsages usages, PixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfoCubeMapArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfoCubeMapArray(ImageUsages usages, Magnum::PixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfoCubeMapArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} + /** @overload */ + explicit ImageCreateInfoCubeMapArray(ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector3i& size, Int levels, Int samples, Flags flags): ImageCreateInfoCubeMapArray{usages, format, size, levels, samples, ImageLayout::Undefined, flags} {} }; }} diff --git a/src/Magnum/Vk/ImageView.cpp b/src/Magnum/Vk/ImageView.cpp index abee6cb77..0cb6a1e5a 100644 --- a/src/Magnum/Vk/ImageView.cpp +++ b/src/Magnum/Vk/ImageView.cpp @@ -29,6 +29,7 @@ #include "Magnum/Vk/Assert.h" #include "Magnum/Vk/Device.h" #include "Magnum/Vk/Image.h" +#include "Magnum/Vk/PixelFormat.h" namespace Magnum { namespace Vk { @@ -36,15 +37,16 @@ namespace { /* Vulkan, it would kill you if 0 was a valid default, right?! ffs */ /** @todo this might be useful elsewhere as well */ -VkImageAspectFlags aspectFor(const VkFormat format) { - if(format == VK_FORMAT_D16_UNORM_S8_UINT || - format == VK_FORMAT_D24_UNORM_S8_UINT || - format == VK_FORMAT_D32_SFLOAT_S8_UINT) +VkImageAspectFlags aspectFor(const PixelFormat format) { + if(format == PixelFormat::Depth16UnormStencil8UI || + format == PixelFormat::Depth24UnormStencil8UI || + format == PixelFormat::Depth32FStencil8UI) return VK_IMAGE_ASPECT_DEPTH_BIT|VK_IMAGE_ASPECT_STENCIL_BIT; - if(format == VK_FORMAT_D16_UNORM || - format == VK_FORMAT_D32_SFLOAT) + if(format == PixelFormat::Depth16Unorm || + format == PixelFormat::Depth24Unorm || + format == PixelFormat::Depth32F) return VK_IMAGE_ASPECT_DEPTH_BIT; - if(format == VK_FORMAT_S8_UINT) + if(format == PixelFormat::Stencil8UI) return VK_IMAGE_ASPECT_STENCIL_BIT; /** @todo planar formats */ @@ -54,12 +56,12 @@ VkImageAspectFlags aspectFor(const VkFormat format) { } -ImageViewCreateInfo::ImageViewCreateInfo(const VkImageViewType type, const VkImage image, const VkFormat format, const UnsignedInt layerOffset, const UnsignedInt layerCount, const UnsignedInt levelOffset, const UnsignedInt levelCount, const Flags flags): _info{} { +ImageViewCreateInfo::ImageViewCreateInfo(const VkImageViewType type, const VkImage image, const PixelFormat format, const UnsignedInt layerOffset, const UnsignedInt layerCount, const UnsignedInt levelOffset, const UnsignedInt levelCount, const Flags flags): _info{} { _info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; _info.flags = VkImageViewCreateFlags(flags); _info.image = image; _info.viewType = type; - _info.format = format; + _info.format = VkFormat(format); _info.subresourceRange.aspectMask = aspectFor(format); _info.subresourceRange.baseMipLevel = levelOffset; _info.subresourceRange.levelCount = levelCount; @@ -67,8 +69,12 @@ ImageViewCreateInfo::ImageViewCreateInfo(const VkImageViewType type, const VkIma _info.subresourceRange.layerCount = layerCount; } +ImageViewCreateInfo::ImageViewCreateInfo(const VkImageViewType type, const VkImage image, const Magnum::PixelFormat format, const UnsignedInt layerOffset, const UnsignedInt layerCount, const UnsignedInt levelOffset, const UnsignedInt levelCount, const Flags flags): ImageViewCreateInfo{type, image, pixelFormat(format), layerOffset, layerCount, levelOffset, levelCount, flags} {} + +ImageViewCreateInfo::ImageViewCreateInfo(const VkImageViewType type, const VkImage image, const Magnum::CompressedPixelFormat format, const UnsignedInt layerOffset, const UnsignedInt layerCount, const UnsignedInt levelOffset, const UnsignedInt levelCount, const Flags flags): ImageViewCreateInfo{type, image, pixelFormat(format), layerOffset, layerCount, levelOffset, levelCount, flags} {} + ImageViewCreateInfo::ImageViewCreateInfo(const VkImageViewType type, Image& image, const UnsignedInt layerOffset, const UnsignedInt layerCount, const UnsignedInt levelOffset, const UnsignedInt levelCount, const Flags flags): ImageViewCreateInfo{type, image, image.format(), layerOffset, layerCount, levelOffset, levelCount, flags} { - CORRADE_ASSERT(image.format(), + CORRADE_ASSERT(VkFormat(image.format()), "Vk::ImageViewCreateInfo: the image has unknown format, you have to specify it explicitly", ); } diff --git a/src/Magnum/Vk/ImageViewCreateInfo.h b/src/Magnum/Vk/ImageViewCreateInfo.h index ed6a4db80..0454ee15b 100644 --- a/src/Magnum/Vk/ImageViewCreateInfo.h +++ b/src/Magnum/Vk/ImageViewCreateInfo.h @@ -57,7 +57,7 @@ class MAGNUM_VK_EXPORT ImageViewCreateInfo { * @brief Image view creation flag * * Wraps @type_vk_keyword{ImageViewCreateFlagBits}. - * @see @ref Flags, @ref ImageViewCreateInfo(VkImageViewType, VkImage, VkFormat, UnsignedInt, UnsignedInt, UnsignedInt, UnsignedInt, Flags) + * @see @ref Flags, @ref ImageViewCreateInfo(VkImageViewType, VkImage, PixelFormat, UnsignedInt, UnsignedInt, UnsignedInt, UnsignedInt, Flags) * @m_enum_values_as_keywords */ enum class Flag: UnsignedInt { @@ -68,7 +68,7 @@ class MAGNUM_VK_EXPORT ImageViewCreateInfo { * @brief ImageView creation flags * * Type-safe wrapper for @type_vk_keyword{ImageViewCreateFlags}. - * @see @ref ImageViewCreateInfo(VkImageViewType, VkImage, VkFormat, UnsignedInt, UnsignedInt, UnsignedInt, UnsignedInt, Flags) + * @see @ref ImageViewCreateInfo(VkImageViewType, VkImage, PixelFormat, UnsignedInt, UnsignedInt, UnsignedInt, UnsignedInt, Flags) */ typedef Containers::EnumSet Flags; @@ -112,12 +112,16 @@ class MAGNUM_VK_EXPORT ImageViewCreateInfo { * @ref ImageViewCreateInfoCubeMapArray convenience classes instead of * this constructor. */ - explicit ImageViewCreateInfo(VkImageViewType type, VkImage image, VkFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}); + explicit ImageViewCreateInfo(VkImageViewType type, VkImage image, PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}); + /** @overload */ + explicit ImageViewCreateInfo(VkImageViewType type, VkImage image, Magnum::PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}); + /** @overload */ + explicit ImageViewCreateInfo(VkImageViewType type, VkImage image, Magnum::CompressedPixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}); /** * @brief Construct with format matching given image * - * Compared to @ref ImageViewCreateInfo(VkImageViewType, VkImage, VkFormat, UnsignedInt, UnsignedInt, UnsignedInt, UnsignedInt, Flags) + * Compared to @ref ImageViewCreateInfo(VkImageViewType, VkImage, PixelFormat, UnsignedInt, UnsignedInt, UnsignedInt, UnsignedInt, Flags) * the @p format is taken from @ref Image::format(). */ explicit ImageViewCreateInfo(VkImageViewType type, Image& image, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}); @@ -169,7 +173,11 @@ type @val_vk{IMAGE_VIEW_TYPE_1D,ImageViewType} with @p layerCount set to class ImageViewCreateInfo1D: public ImageViewCreateInfo { public: /** @brief Constructor */ - explicit ImageViewCreateInfo1D(VkImage image, VkFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_1D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + explicit ImageViewCreateInfo1D(VkImage image, PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_1D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo1D(VkImage image, Magnum::PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_1D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo1D(VkImage image, Magnum::CompressedPixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_1D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} /** @overload * @@ -195,7 +203,11 @@ type @val_vk{IMAGE_VIEW_TYPE_2D,ImageViewType} with @p layerCount set to class ImageViewCreateInfo2D: public ImageViewCreateInfo { public: /** @brief Constructor */ - explicit ImageViewCreateInfo2D(VkImage image, VkFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + explicit ImageViewCreateInfo2D(VkImage image, PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo2D(VkImage image, Magnum::PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo2D(VkImage image, Magnum::CompressedPixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} /** @overload * @@ -216,7 +228,11 @@ type @val_vk{IMAGE_VIEW_TYPE_3D,ImageViewType} with @p layerCount set to class ImageViewCreateInfo3D: public ImageViewCreateInfo { public: /** @brief Constructor */ - explicit ImageViewCreateInfo3D(VkImage image, VkFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_3D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + explicit ImageViewCreateInfo3D(VkImage image, PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_3D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo3D(VkImage image, Magnum::PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_3D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo3D(VkImage image, Magnum::CompressedPixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_3D, image, format, layerOffset, 1, levelOffset, levelCount, flags} {} /** @overload * @@ -238,7 +254,11 @@ to fit the required subrange. class ImageViewCreateInfo1DArray: public ImageViewCreateInfo { public: /** @brief Constructor */ - explicit ImageViewCreateInfo1DArray(VkImage image, VkFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_1D_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + explicit ImageViewCreateInfo1DArray(VkImage image, PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_1D_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo1DArray(VkImage image, Magnum::PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_1D_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo1DArray(VkImage image, Magnum::CompressedPixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_1D_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} /** @overload * @@ -264,7 +284,11 @@ subrange. class ImageViewCreateInfo2DArray: public ImageViewCreateInfo { public: /** @brief Constructor */ - explicit ImageViewCreateInfo2DArray(VkImage image, VkFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + explicit ImageViewCreateInfo2DArray(VkImage image, PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo2DArray(VkImage image, Magnum::PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfo2DArray(VkImage image, Magnum::CompressedPixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} /** @overload * @@ -287,7 +311,11 @@ set (e.g., created using @ref ImageCreateInfoCubeMap or class ImageViewCreateInfoCubeMap: public ImageViewCreateInfo { public: /** @brief Constructor */ - explicit ImageViewCreateInfoCubeMap(VkImage image, VkFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_CUBE, image, format, layerOffset, 6, levelOffset, levelCount, flags} {} + explicit ImageViewCreateInfoCubeMap(VkImage image, PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_CUBE, image, format, layerOffset, 6, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfoCubeMap(VkImage image, Magnum::PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_CUBE, image, format, layerOffset, 6, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfoCubeMap(VkImage image, Magnum::CompressedPixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_CUBE, image, format, layerOffset, 6, levelOffset, levelCount, flags} {} /** @overload * @@ -311,7 +339,11 @@ array layers to fit the required subrange. class ImageViewCreateInfoCubeMapArray: public ImageViewCreateInfo { public: /** @brief Constructor */ - explicit ImageViewCreateInfoCubeMapArray(VkImage image, VkFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + explicit ImageViewCreateInfoCubeMapArray(VkImage image, PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfoCubeMapArray(VkImage image, Magnum::PixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} + /** @overload */ + explicit ImageViewCreateInfoCubeMapArray(VkImage image, Magnum::CompressedPixelFormat format, UnsignedInt layerOffset = 0, UnsignedInt layerCount = VK_REMAINING_ARRAY_LAYERS, UnsignedInt levelOffset = 0, UnsignedInt levelCount = VK_REMAINING_MIP_LEVELS, Flags flags = {}): ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, image, format, layerOffset, layerCount, levelOffset, levelCount, flags} {} /** @overload * diff --git a/src/Magnum/Vk/Implementation/compressedPixelFormatMapping.hpp b/src/Magnum/Vk/Implementation/compressedPixelFormatMapping.hpp index 5085f3d71..55b4e4731 100644 --- a/src/Magnum/Vk/Implementation/compressedPixelFormatMapping.hpp +++ b/src/Magnum/Vk/Implementation/compressedPixelFormatMapping.hpp @@ -25,74 +25,75 @@ /* See Magnum/Vk/Enums.cpp and Magnum/Vk/Test/EnumsTest.cpp */ #ifdef _c -_c(Bc1RGBUnorm, BC1_RGB_UNORM_BLOCK) -_c(Bc1RGBSrgb, BC1_RGB_SRGB_BLOCK) -_c(Bc1RGBAUnorm, BC1_RGBA_UNORM_BLOCK) -_c(Bc1RGBASrgb, BC1_RGBA_SRGB_BLOCK) -_c(Bc2RGBAUnorm, BC2_UNORM_BLOCK) -_c(Bc2RGBASrgb, BC2_SRGB_BLOCK) -_c(Bc3RGBAUnorm, BC3_UNORM_BLOCK) -_c(Bc3RGBASrgb, BC3_SRGB_BLOCK) -_c(Bc4RUnorm, BC4_UNORM_BLOCK) -_c(Bc4RSnorm, BC4_SNORM_BLOCK) -_c(Bc5RGUnorm, BC5_UNORM_BLOCK) -_c(Bc5RGSnorm, BC5_SNORM_BLOCK) -_c(Bc6hRGBUfloat, BC6H_UFLOAT_BLOCK) -_c(Bc6hRGBSfloat, BC6H_SFLOAT_BLOCK) -_c(Bc7RGBAUnorm, BC7_UNORM_BLOCK) -_c(Bc7RGBASrgb, BC7_SRGB_BLOCK) -_c(EacR11Unorm, EAC_R11_UNORM_BLOCK) -_c(EacR11Snorm, EAC_R11_SNORM_BLOCK) -_c(EacRG11Unorm, EAC_R11G11_UNORM_BLOCK) -_c(EacRG11Snorm, EAC_R11G11_SNORM_BLOCK) -_c(Etc2RGB8Unorm, ETC2_R8G8B8_UNORM_BLOCK) -_c(Etc2RGB8Srgb, ETC2_R8G8B8_SRGB_BLOCK) -_c(Etc2RGB8A1Unorm, ETC2_R8G8B8A1_UNORM_BLOCK) -_c(Etc2RGB8A1Srgb, ETC2_R8G8B8A1_SRGB_BLOCK) -_c(Etc2RGBA8Unorm, ETC2_R8G8B8A8_UNORM_BLOCK) -_c(Etc2RGBA8Srgb, ETC2_R8G8B8A8_SRGB_BLOCK) -_c(Astc4x4RGBAUnorm, ASTC_4x4_UNORM_BLOCK) -_c(Astc4x4RGBASrgb, ASTC_4x4_SRGB_BLOCK) -_c(Astc4x4RGBAF, ASTC_4x4_SFLOAT_BLOCK_EXT) -_c(Astc5x4RGBAUnorm, ASTC_5x4_UNORM_BLOCK) -_c(Astc5x4RGBASrgb, ASTC_5x4_SRGB_BLOCK) -_c(Astc5x4RGBAF, ASTC_5x4_SFLOAT_BLOCK_EXT) -_c(Astc5x5RGBAUnorm, ASTC_5x5_UNORM_BLOCK) -_c(Astc5x5RGBASrgb, ASTC_5x5_SRGB_BLOCK) -_c(Astc5x5RGBAF, ASTC_5x5_SFLOAT_BLOCK_EXT) -_c(Astc6x5RGBAUnorm, ASTC_6x5_UNORM_BLOCK) -_c(Astc6x5RGBASrgb, ASTC_6x5_SRGB_BLOCK) -_c(Astc6x5RGBAF, ASTC_6x5_SFLOAT_BLOCK_EXT) -_c(Astc6x6RGBAUnorm, ASTC_6x6_UNORM_BLOCK) -_c(Astc6x6RGBASrgb, ASTC_6x6_SRGB_BLOCK) -_c(Astc6x6RGBAF, ASTC_6x6_SFLOAT_BLOCK_EXT) -_c(Astc8x5RGBAUnorm, ASTC_8x5_UNORM_BLOCK) -_c(Astc8x5RGBASrgb, ASTC_8x5_SRGB_BLOCK) -_c(Astc8x5RGBAF, ASTC_8x5_SFLOAT_BLOCK_EXT) -_c(Astc8x6RGBAUnorm, ASTC_8x6_UNORM_BLOCK) -_c(Astc8x6RGBASrgb, ASTC_8x6_SRGB_BLOCK) -_c(Astc8x6RGBAF, ASTC_8x6_SFLOAT_BLOCK_EXT) -_c(Astc8x8RGBAUnorm, ASTC_8x8_UNORM_BLOCK) -_c(Astc8x8RGBASrgb, ASTC_8x8_SRGB_BLOCK) -_c(Astc8x8RGBAF, ASTC_8x8_SFLOAT_BLOCK_EXT) -_c(Astc10x5RGBAUnorm, ASTC_10x5_UNORM_BLOCK) -_c(Astc10x5RGBASrgb, ASTC_10x5_SRGB_BLOCK) -_c(Astc10x5RGBAF, ASTC_10x5_SFLOAT_BLOCK_EXT) -_c(Astc10x6RGBAUnorm, ASTC_10x6_UNORM_BLOCK) -_c(Astc10x6RGBASrgb, ASTC_10x6_SRGB_BLOCK) -_c(Astc10x6RGBAF, ASTC_10x6_SFLOAT_BLOCK_EXT) -_c(Astc10x8RGBAUnorm, ASTC_10x8_UNORM_BLOCK) -_c(Astc10x8RGBASrgb, ASTC_10x8_SRGB_BLOCK) -_c(Astc10x8RGBAF, ASTC_10x8_SFLOAT_BLOCK_EXT) -_c(Astc10x10RGBAUnorm, ASTC_10x10_UNORM_BLOCK) -_c(Astc10x10RGBASrgb, ASTC_10x10_SRGB_BLOCK) -_c(Astc10x10RGBAF, ASTC_10x10_SFLOAT_BLOCK_EXT) -_c(Astc12x10RGBAUnorm, ASTC_12x10_UNORM_BLOCK) -_c(Astc12x10RGBASrgb, ASTC_12x10_SRGB_BLOCK) -_c(Astc12x10RGBAF, ASTC_12x10_SFLOAT_BLOCK_EXT) -_c(Astc12x12RGBAUnorm, ASTC_12x12_UNORM_BLOCK) -_c(Astc12x12RGBASrgb, ASTC_12x12_SRGB_BLOCK) -_c(Astc12x12RGBAF, ASTC_12x12_SFLOAT_BLOCK_EXT) +#define _c2(input) _c(input, input) +_c2(Bc1RGBUnorm) +_c2(Bc1RGBSrgb) +_c2(Bc1RGBAUnorm) +_c2(Bc1RGBASrgb) +_c2(Bc2RGBAUnorm) +_c2(Bc2RGBASrgb) +_c2(Bc3RGBAUnorm) +_c2(Bc3RGBASrgb) +_c2(Bc4RUnorm) +_c2(Bc4RSnorm) +_c2(Bc5RGUnorm) +_c2(Bc5RGSnorm) +_c2(Bc6hRGBUfloat) +_c2(Bc6hRGBSfloat) +_c2(Bc7RGBAUnorm) +_c2(Bc7RGBASrgb) +_c2(EacR11Unorm) +_c2(EacR11Snorm) +_c2(EacRG11Unorm) +_c2(EacRG11Snorm) +_c2(Etc2RGB8Unorm) +_c2(Etc2RGB8Srgb) +_c2(Etc2RGB8A1Unorm) +_c2(Etc2RGB8A1Srgb) +_c2(Etc2RGBA8Unorm) +_c2(Etc2RGBA8Srgb) +_c2(Astc4x4RGBAUnorm) +_c2(Astc4x4RGBASrgb) +_c2(Astc4x4RGBAF) +_c2(Astc5x4RGBAUnorm) +_c2(Astc5x4RGBASrgb) +_c2(Astc5x4RGBAF) +_c2(Astc5x5RGBAUnorm) +_c2(Astc5x5RGBASrgb) +_c2(Astc5x5RGBAF) +_c2(Astc6x5RGBAUnorm) +_c2(Astc6x5RGBASrgb) +_c2(Astc6x5RGBAF) +_c2(Astc6x6RGBAUnorm) +_c2(Astc6x6RGBASrgb) +_c2(Astc6x6RGBAF) +_c2(Astc8x5RGBAUnorm) +_c2(Astc8x5RGBASrgb) +_c2(Astc8x5RGBAF) +_c2(Astc8x6RGBAUnorm) +_c2(Astc8x6RGBASrgb) +_c2(Astc8x6RGBAF) +_c2(Astc8x8RGBAUnorm) +_c2(Astc8x8RGBASrgb) +_c2(Astc8x8RGBAF) +_c2(Astc10x5RGBAUnorm) +_c2(Astc10x5RGBASrgb) +_c2(Astc10x5RGBAF) +_c2(Astc10x6RGBAUnorm) +_c2(Astc10x6RGBASrgb) +_c2(Astc10x6RGBAF) +_c2(Astc10x8RGBAUnorm) +_c2(Astc10x8RGBASrgb) +_c2(Astc10x8RGBAF) +_c2(Astc10x10RGBAUnorm) +_c2(Astc10x10RGBASrgb) +_c2(Astc10x10RGBAF) +_c2(Astc12x10RGBAUnorm) +_c2(Astc12x10RGBASrgb) +_c2(Astc12x10RGBAF) +_c2(Astc12x12RGBAUnorm) +_c2(Astc12x12RGBASrgb) +_c2(Astc12x12RGBAF) /* https://github.com/KhronosGroup/KTX-Specification/pull/97 */ _s(Astc3x3x3RGBAUnorm) //, ASTC_3x3x3_UNORM_BLOCK) @@ -127,12 +128,13 @@ _s(Astc6x6x6RGBASrgb) //, ASTC_6x6x6_SRGB_BLOCK) _s(Astc6x6x6RGBAF) //, ASTC_6x6x6_SFLOAT_BLOCK_EXT) /* https://github.com/KhronosGroup/Vulkan-Docs/issues/512 */ -_c(PvrtcRGB2bppUnorm, PVRTC1_2BPP_UNORM_BLOCK_IMG) -_c(PvrtcRGB2bppSrgb, PVRTC1_2BPP_SRGB_BLOCK_IMG) -_c(PvrtcRGBA2bppUnorm, PVRTC1_2BPP_UNORM_BLOCK_IMG) -_c(PvrtcRGBA2bppSrgb, PVRTC1_2BPP_SRGB_BLOCK_IMG) -_c(PvrtcRGB4bppUnorm, PVRTC1_4BPP_UNORM_BLOCK_IMG) -_c(PvrtcRGB4bppSrgb, PVRTC1_4BPP_SRGB_BLOCK_IMG) -_c(PvrtcRGBA4bppUnorm, PVRTC1_4BPP_UNORM_BLOCK_IMG) -_c(PvrtcRGBA4bppSrgb, PVRTC1_4BPP_SRGB_BLOCK_IMG) +_c(PvrtcRGB2bppUnorm, PvrtcRGBA2bppUnorm) +_c(PvrtcRGB2bppSrgb, PvrtcRGBA2bppSrgb) +_c2(PvrtcRGBA2bppUnorm) +_c2(PvrtcRGBA2bppSrgb) +_c(PvrtcRGB4bppUnorm, PvrtcRGBA4bppUnorm) +_c(PvrtcRGB4bppSrgb, PvrtcRGBA4bppSrgb) +_c2(PvrtcRGBA4bppUnorm) +_c2(PvrtcRGBA4bppSrgb) +#undef _c2 #endif diff --git a/src/Magnum/Vk/Implementation/pixelFormatMapping.hpp b/src/Magnum/Vk/Implementation/pixelFormatMapping.hpp index 99ddd0c76..b9d1946d7 100644 --- a/src/Magnum/Vk/Implementation/pixelFormatMapping.hpp +++ b/src/Magnum/Vk/Implementation/pixelFormatMapping.hpp @@ -25,56 +25,56 @@ /* See Magnum/Vk/Enums.cpp and Magnum/Vk/Test/EnumsTest.cpp */ #ifdef _c -_c(R8Unorm, R8_UNORM) -_c(RG8Unorm, R8G8_UNORM) -_c(RGB8Unorm, R8G8B8_UNORM) -_c(RGBA8Unorm, R8G8B8A8_UNORM) -_c(R8Snorm, R8_SNORM) -_c(RG8Snorm, R8G8_SNORM) -_c(RGB8Snorm, R8G8B8_SNORM) -_c(RGBA8Snorm, R8G8B8A8_SNORM) -_c(R8Srgb, R8_SRGB) -_c(RG8Srgb, R8G8_SRGB) -_c(RGB8Srgb, R8G8B8_SRGB) -_c(RGBA8Srgb, R8G8B8A8_SRGB) -_c(R8UI, R8_UINT) -_c(RG8UI, R8G8_UINT) -_c(RGB8UI, R8G8B8_UINT) -_c(RGBA8UI, R8G8B8A8_UINT) -_c(R8I, R8_SINT) -_c(RG8I, R8G8_SINT) -_c(RGB8I, R8G8B8_SINT) -_c(RGBA8I, R8G8B8A8_SINT) -_c(R16Unorm, R16_UNORM) -_c(RG16Unorm, R16G16_UNORM) -_c(RGB16Unorm, R16G16B16_UNORM) -_c(RGBA16Unorm, R16G16B16A16_UNORM) -_c(R16Snorm, R16_SNORM) -_c(RG16Snorm, R16G16_SNORM) -_c(RGB16Snorm, R16G16B16_SNORM) -_c(RGBA16Snorm, R16G16B16A16_SNORM) -_c(R16UI, R16_UINT) -_c(RG16UI, R16G16_UINT) -_c(RGB16UI, R16G16B16_UINT) -_c(RGBA16UI, R16G16B16A16_UINT) -_c(R16I, R16_SINT) -_c(RG16I, R16G16_SINT) -_c(RGB16I, R16G16B16_SINT) -_c(RGBA16I, R16G16B16A16_SINT) -_c(R32UI, R32_UINT) -_c(RG32UI, R32G32_UINT) -_c(RGB32UI, R32G32B32_UINT) -_c(RGBA32UI, R32G32B32A32_UINT) -_c(R32I, R32_SINT) -_c(RG32I, R32G32_SINT) -_c(RGB32I, R32G32B32_SINT) -_c(RGBA32I, R32G32B32A32_SINT) -_c(R16F, R16_SFLOAT) -_c(RG16F, R16G16_SFLOAT) -_c(RGB16F, R16G16B16_SFLOAT) -_c(RGBA16F, R16G16B16A16_SFLOAT) -_c(R32F, R32_SFLOAT) -_c(RG32F, R32G32_SFLOAT) -_c(RGB32F, R32G32B32_SFLOAT) -_c(RGBA32F, R32G32B32A32_SFLOAT) +_c(R8Unorm) +_c(RG8Unorm) +_c(RGB8Unorm) +_c(RGBA8Unorm) +_c(R8Snorm) +_c(RG8Snorm) +_c(RGB8Snorm) +_c(RGBA8Snorm) +_c(R8Srgb) +_c(RG8Srgb) +_c(RGB8Srgb) +_c(RGBA8Srgb) +_c(R8UI) +_c(RG8UI) +_c(RGB8UI) +_c(RGBA8UI) +_c(R8I) +_c(RG8I) +_c(RGB8I) +_c(RGBA8I) +_c(R16Unorm) +_c(RG16Unorm) +_c(RGB16Unorm) +_c(RGBA16Unorm) +_c(R16Snorm) +_c(RG16Snorm) +_c(RGB16Snorm) +_c(RGBA16Snorm) +_c(R16UI) +_c(RG16UI) +_c(RGB16UI) +_c(RGBA16UI) +_c(R16I) +_c(RG16I) +_c(RGB16I) +_c(RGBA16I) +_c(R32UI) +_c(RG32UI) +_c(RGB32UI) +_c(RGBA32UI) +_c(R32I) +_c(RG32I) +_c(RGB32I) +_c(RGBA32I) +_c(R16F) +_c(RG16F) +_c(RGB16F) +_c(RGBA16F) +_c(R32F) +_c(RG32F) +_c(RGB32F) +_c(RGBA32F) #endif diff --git a/src/Magnum/Vk/PixelFormat.cpp b/src/Magnum/Vk/PixelFormat.cpp new file mode 100644 index 000000000..143a835f7 --- /dev/null +++ b/src/Magnum/Vk/PixelFormat.cpp @@ -0,0 +1,248 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, + 2020 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. +*/ + +#include "PixelFormat.h" + +#include +#include + +#include "Magnum/PixelFormat.h" + +namespace Magnum { namespace Vk { + +namespace { + +constexpr PixelFormat PixelFormatMapping[] { + /* GCC 4.8 doesn't like just a {} for default enum values */ + #define _c(input) PixelFormat::input, + #define _s(input) PixelFormat{}, + #include "Magnum/Vk/Implementation/pixelFormatMapping.hpp" + #undef _s + #undef _c +}; + +constexpr PixelFormat CompressedPixelFormatMapping[] { + /* GCC 4.8 doesn't like just a {} for default enum values */ + #define _c(input, format) PixelFormat::Compressed ## format, + #define _s(input) PixelFormat{}, + #include "Magnum/Vk/Implementation/compressedPixelFormatMapping.hpp" + #undef _s + #undef _c +}; + +} + +Debug& operator<<(Debug& debug, const PixelFormat value) { + debug << "Vk::PixelFormat" << Debug::nospace; + + switch(value) { + /* LCOV_EXCL_START */ + #define _c(value) case Vk::PixelFormat::value: return debug << "::" << Debug::nospace << #value; + _c(R8Unorm) + _c(RG8Unorm) + _c(RGB8Unorm) + _c(RGBA8Unorm) + _c(R8Snorm) + _c(RG8Snorm) + _c(RGB8Snorm) + _c(RGBA8Snorm) + _c(R8Srgb) + _c(RG8Srgb) + _c(RGB8Srgb) + _c(RGBA8Srgb) + _c(R8UI) + _c(RG8UI) + _c(RGB8UI) + _c(RGBA8UI) + _c(R8I) + _c(RG8I) + _c(RGB8I) + _c(RGBA8I) + _c(R16Unorm) + _c(RG16Unorm) + _c(RGB16Unorm) + _c(RGBA16Unorm) + _c(R16Snorm) + _c(RG16Snorm) + _c(RGB16Snorm) + _c(RGBA16Snorm) + _c(R16UI) + _c(RG16UI) + _c(RGB16UI) + _c(RGBA16UI) + _c(R16I) + _c(RG16I) + _c(RGB16I) + _c(RGBA16I) + _c(R32UI) + _c(RG32UI) + _c(RGB32UI) + _c(RGBA32UI) + _c(R32I) + _c(RG32I) + _c(RGB32I) + _c(RGBA32I) + _c(R16F) + _c(RG16F) + _c(RGB16F) + _c(RGBA16F) + _c(R32F) + _c(RG32F) + _c(RGB32F) + _c(RGBA32F) + _c(Depth16Unorm) + _c(Depth24Unorm) + _c(Depth32F) + _c(Stencil8UI) + _c(Depth16UnormStencil8UI) + _c(Depth24UnormStencil8UI) + _c(Depth32FStencil8UI) + _c(CompressedBc1RGBUnorm) + _c(CompressedBc1RGBSrgb) + _c(CompressedBc1RGBAUnorm) + _c(CompressedBc1RGBASrgb) + _c(CompressedBc2RGBAUnorm) + _c(CompressedBc2RGBASrgb) + _c(CompressedBc3RGBAUnorm) + _c(CompressedBc3RGBASrgb) + _c(CompressedBc4RUnorm) + _c(CompressedBc4RSnorm) + _c(CompressedBc5RGUnorm) + _c(CompressedBc5RGSnorm) + _c(CompressedBc6hRGBUfloat) + _c(CompressedBc6hRGBSfloat) + _c(CompressedBc7RGBAUnorm) + _c(CompressedBc7RGBASrgb) + _c(CompressedEacR11Unorm) + _c(CompressedEacR11Snorm) + _c(CompressedEacRG11Unorm) + _c(CompressedEacRG11Snorm) + _c(CompressedEtc2RGB8Unorm) + _c(CompressedEtc2RGB8Srgb) + _c(CompressedEtc2RGB8A1Unorm) + _c(CompressedEtc2RGB8A1Srgb) + _c(CompressedEtc2RGBA8Unorm) + _c(CompressedEtc2RGBA8Srgb) + _c(CompressedAstc4x4RGBAUnorm) + _c(CompressedAstc4x4RGBASrgb) + _c(CompressedAstc4x4RGBAF) + _c(CompressedAstc5x4RGBAUnorm) + _c(CompressedAstc5x4RGBASrgb) + _c(CompressedAstc5x4RGBAF) + _c(CompressedAstc5x5RGBAUnorm) + _c(CompressedAstc5x5RGBASrgb) + _c(CompressedAstc5x5RGBAF) + _c(CompressedAstc6x5RGBAUnorm) + _c(CompressedAstc6x5RGBASrgb) + _c(CompressedAstc6x5RGBAF) + _c(CompressedAstc6x6RGBAUnorm) + _c(CompressedAstc6x6RGBASrgb) + _c(CompressedAstc6x6RGBAF) + _c(CompressedAstc8x5RGBAUnorm) + _c(CompressedAstc8x5RGBASrgb) + _c(CompressedAstc8x5RGBAF) + _c(CompressedAstc8x6RGBAUnorm) + _c(CompressedAstc8x6RGBASrgb) + _c(CompressedAstc8x6RGBAF) + _c(CompressedAstc8x8RGBAUnorm) + _c(CompressedAstc8x8RGBASrgb) + _c(CompressedAstc8x8RGBAF) + _c(CompressedAstc10x5RGBAUnorm) + _c(CompressedAstc10x5RGBASrgb) + _c(CompressedAstc10x5RGBAF) + _c(CompressedAstc10x6RGBAUnorm) + _c(CompressedAstc10x6RGBASrgb) + _c(CompressedAstc10x6RGBAF) + _c(CompressedAstc10x8RGBAUnorm) + _c(CompressedAstc10x8RGBASrgb) + _c(CompressedAstc10x8RGBAF) + _c(CompressedAstc10x10RGBAUnorm) + _c(CompressedAstc10x10RGBASrgb) + _c(CompressedAstc10x10RGBAF) + _c(CompressedAstc12x10RGBAUnorm) + _c(CompressedAstc12x10RGBASrgb) + _c(CompressedAstc12x10RGBAF) + _c(CompressedAstc12x12RGBAUnorm) + _c(CompressedAstc12x12RGBASrgb) + _c(CompressedAstc12x12RGBAF) + _c(CompressedPvrtcRGBA2bppUnorm) + _c(CompressedPvrtcRGBA2bppSrgb) + _c(CompressedPvrtcRGBA4bppUnorm) + _c(CompressedPvrtcRGBA4bppSrgb) + _c(CompressedPvrtc2RGBA2bppUnorm) + _c(CompressedPvrtc2RGBA2bppSrgb) + _c(CompressedPvrtc2RGBA4bppUnorm) + _c(CompressedPvrtc2RGBA4bppSrgb) + #undef _c + /* LCOV_EXCL_STOP */ + } + + /* Vulkan docs have the values in decimal, so not converting to hex */ + return debug << "(" << Debug::nospace << Int(value) << Debug::nospace << ")"; +} + +bool hasPixelFormat(const Magnum::PixelFormat format) { + if(isPixelFormatImplementationSpecific(format)) + return true; + + CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(PixelFormatMapping), + "Vk::hasPixelFormat(): invalid format" << format, {}); + return UnsignedInt(PixelFormatMapping[UnsignedInt(format) - 1]); +} + +bool hasPixelFormat(const Magnum::CompressedPixelFormat format) { + if(isCompressedPixelFormatImplementationSpecific(format)) + return true; + + CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(CompressedPixelFormatMapping), + "Vk::hasPixelFormat(): invalid format" << format, {}); + return UnsignedInt(CompressedPixelFormatMapping[UnsignedInt(format) - 1]); +} + +PixelFormat pixelFormat(const Magnum::PixelFormat format) { + if(isPixelFormatImplementationSpecific(format)) + return pixelFormatUnwrap(format); + + CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(PixelFormatMapping), + "Vk::pixelFormat(): invalid format" << format, {}); + const PixelFormat out = PixelFormatMapping[UnsignedInt(format) - 1]; + CORRADE_ASSERT(UnsignedInt(out), + "Vk::pixelFormat(): unsupported format" << format, {}); + return out; +} + +PixelFormat pixelFormat(const Magnum::CompressedPixelFormat format) { + if(isCompressedPixelFormatImplementationSpecific(format)) + return compressedPixelFormatUnwrap(format); + + CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(CompressedPixelFormatMapping), + "Vk::pixelFormat(): invalid format" << format, {}); + const PixelFormat out = CompressedPixelFormatMapping[UnsignedInt(format) - 1]; + CORRADE_ASSERT(UnsignedInt(out), + "Vk::pixelFormat(): unsupported format" << format, {}); + return out; +} + +}} diff --git a/src/Magnum/Vk/PixelFormat.h b/src/Magnum/Vk/PixelFormat.h new file mode 100644 index 000000000..73f55349e --- /dev/null +++ b/src/Magnum/Vk/PixelFormat.h @@ -0,0 +1,1467 @@ +#ifndef Magnum_Vk_PixelFormat_h +#define Magnum_Vk_PixelFormat_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, + 2020 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. +*/ + +#include "Magnum/Magnum.h" +#include "Magnum/Vk/Vulkan.h" +#include "Magnum/Vk/visibility.h" + +/** @file + * @brief Enum @ref Magnum::Vk::PixelFormat, function @ref Magnum::Vk::hasPixelFormat(), @ref Magnum::Vk::pixelFormat() + * @m_since_latest + */ + +namespace Magnum { namespace Vk { + +/** +@brief Pixel format +@m_since_latest + +Wraps a subset of @type_vk_keyword{Format} that's usable as a pixel format. + +Note that while Vulkan exposes almost all imaginable formats, they're not +universally usable in all scenarios and the support differs from device to +device. To make things simpler, Vulkan provides implicit guarantees where +certain formats can be used, see documentation of each value for more +information. Generally, the following rules apply for uncompressed color +formats: + +- All implicit guarantees are only for optimal tiling, not linear +- RGB formats of all sizes don't have *any* guarantees due to alignment + issues, and use of two- or four-channel formats is preferred +- Single-channel formats provide the same guarantees as a corresponding + two-channel format, possibly supporting more +- While 8-bit normalized formats have guaranteed support for linear filtering + and blending, it's not implicitly guaranteed for 16-bit normalized formats + --- the support is common, but not universal. +- Signed normalized formats don't have blit destination and color attachment + support guaranteed as opposed to unsigned normalized formats +- Signed and unsigned integral formats of the same channel size and count + provide the exact same guarantees +- Shader storage support is implicitly guaranteed only for full-width + (32-bit) formats, for others it depends on + @ref DeviceFeature::ShaderStorageImageExtendedFormats +- Atomic operation support is only guaranteed for single-channel full-width + integral formats + +For compressed color formats, sampling, blit source and linear filtering has +guaranteed support with optimal tiling either for all BC formats, all ETC +formats or all ASTC LDR formats, and a full support for a particular family of +these formats is denoted by the @ref DeviceFeature::TextureCompressionBc, +@ref DeviceFeature::TextureCompressionEtc2 and +@ref DeviceFeature::TextureCompressionAstcLdr features. + +@m_enum_values_as_keywords +*/ +enum class PixelFormat: Int { + /** + * Red component, normalized unsigned byte. + * + * Sampling, blit source/destination, linear filtering and color attachment + * including blending has guaranteed support with optimal tiling. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + R8Unorm = VK_FORMAT_R8_UNORM, + + /** + * Red and green component, normalized unsigned byte. + * + * Sampling, blit source/destination, linear filtering and color attachment + * including blending has guaranteed support with optimal tiling. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG8Unorm = VK_FORMAT_R8G8_UNORM, + + /** + * RGB, normalized unsigned byte. + * + * Compared to @ref PixelFormat::RG8Unorm / @ref PixelFormat::RGBA8Unorm + * there are no guarantees for this format. + */ + RGB8Unorm = VK_FORMAT_R8G8B8_UNORM, + + /** + * RGBA, normalized unsigned byte. + * + * Sampling, blit source/destination, linear filtering, image storage, + * color attachment including blending has guaranteed support with optimal + * tiling. + */ + RGBA8Unorm = VK_FORMAT_R8G8B8A8_UNORM, + + /** + * Red component, normalized signed byte. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling. Unlike @ref PixelFormat::R8Unorm and + * @ref PixelFormat::R8I, support for blit destination and color attachment + * isn't guaranteed. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + R8Snorm = VK_FORMAT_R8_SNORM, + + /** + * Red and green component, normalized signed byte, + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling. Unlike @ref PixelFormat::RG8Unorm and + * @ref PixelFormat::RG8I, support for blit destination and color + * attachment isn't guaranteed. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG8Snorm = VK_FORMAT_R8G8_SNORM, + + /** + * RGB, normalized signed byte. + * + * Compared to @ref PixelFormat::RG8Snorm / @ref PixelFormat::RGBA8Snorm + * there are no guarantees for this format. + */ + RGB8Snorm = VK_FORMAT_R8G8B8_SNORM, + + /** + * RGBA, normalized signed byte. + * + * Sampling, blit source, linear filtering and image storage has guaranteed + * support with optimal tiling. Unlike @ref PixelFormat::RGBA8Unorm and + * @ref PixelFormat::RGBA8I, support for blit destination and color + * attachment isn't guaranteed. + */ + RGBA8Snorm = VK_FORMAT_R8G8B8A8_SNORM, + + /** + * sRGB-encoded red component, normalized unsigned byte. + * + * Compared to @ref PixelFormat::R8Unorm / @ref PixelFormat::RGBA8Srgb + * there are no guarantees for this format. + */ + R8Srgb = VK_FORMAT_R8_SRGB, + + /** + * sRGB-encoded red and green component, normalized unsigned byte. + * + * Compared to @ref PixelFormat::RG8Unorm / @ref PixelFormat::RGBA8Srgb + * there are no guarantees for this format. + */ + RG8Srgb = VK_FORMAT_R8G8_SRGB, + + /** + * sRGB, normalized unsigned byte + * + * Compared to @ref PixelFormat::RGBA8Srgb there are no guarantees for this + * format. + */ + RGB8Srgb = VK_FORMAT_R8G8B8_SRGB, + + /** + * sRGB + linear alpha, normalized unsigned byte. + * + * Sampling, blit source/destination, linear filtering and color attachment + * including blending has guaranteed support with optimal tiling. Unlike + * @ref PixelFormat::RGBA8Unorm, support for image storage isn't + * guaranteed. + */ + RGBA8Srgb = VK_FORMAT_R8G8B8A8_SRGB, + + /** + * Red component, integral unsigned byte. + * + * Sampling, blit source/destination and color attachment has guaranteed + * support with optimal tiling. Compared to @ref PixelFormat::R8Unorm, + * linear filtering and blending isn't supported. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage. Compared to @ref PixelFormat::R32UI, atomic + * operation support is not guaranteed. + */ + R8UI = VK_FORMAT_R8_UINT, + + /** + * Red and green component, integral unsigned byte. + * + * Sampling, blit source/destination and color attachment has guaranteed + * support with optimal tiling. Compared to @ref PixelFormat::RG8Unorm, + * linear filtering and blending isn't supported. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG8UI = VK_FORMAT_R8G8_UINT, + + /** + * RGB, integral unsigned byte. + * + * Compared to @ref PixelFormat::RG8UI / @ref PixelFormat::RGBA8UI there + * are no guarantees for this format. + */ + RGB8UI = VK_FORMAT_R8G8B8_UINT, + + /** + * RGBA, integral unsigned byte. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. Compared to + * @ref PixelFormat::RGBA8Unorm, linear filtering and blending isn't + * supported. + */ + RGBA8UI = VK_FORMAT_R8G8B8A8_UINT, + + /** + * Red component, integral signed byte. + * + * Sampling, blit source/destination and color attachment has guaranteed + * support with optimal tiling. Compared to @ref PixelFormat::R8Snorm, + * linear filtering and blending isn't supported. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage. Compared to @ref PixelFormat::R32I, atomic + * operation support is not guaranteed. + */ + R8I = VK_FORMAT_R8_SINT, + + /** + * Red and green component, integral signed byte. + * + * Sampling, blit source/destination and color attachment has guaranteed + * support with optimal tiling. Compared to @ref PixelFormat::RG8Snorm, + * linear filtering and blending isn't supported. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG8I = VK_FORMAT_R8G8_SINT, + + /** + * RGB, integral signed byte. + * + * Compared to @ref PixelFormat::RG8I / @ref PixelFormat::RGBA8I there are + * no guarantees for this format. + */ + RGB8I = VK_FORMAT_R8G8B8_SINT, + + /** + * RGBA, integral signed byte. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. Compared to + * @ref PixelFormat::RGBA8Snorm, linear filtering and blending isn't + * supported. + */ + RGBA8I = VK_FORMAT_R8G8B8A8_SINT, + + /** + * Red component, normalized unsigned short. + * + * Compared to @ref PixelFormat::R8Unorm there are no implicit guarantees + * for this format. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + R16Unorm = VK_FORMAT_R16_UNORM, + + /** + * Red and green component, normalized unsigned short. + * + * Compared to @ref PixelFormat::RG8Unorm there are no implicit guarantees + * for this format. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG16Unorm = VK_FORMAT_R16G16_UNORM, + + /** + * RGB, normalized unsigned short. + * + * Compared to @ref PixelFormat::RG16Unorm / @ref PixelFormat::RGBA16Unorm + * there are no guarantees for this format. + */ + RGB16Unorm = VK_FORMAT_R16G16B16_UNORM, + + /** + * RGBA, normalized unsigned short. + * + * Compared to @ref PixelFormat::RGBA8Unorm there are no implicit + * guarantees for this format. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RGBA16Unorm = VK_FORMAT_R16G16B16A16_UNORM, + + /** + * Red component, normalized signed short. + * + * Compared to @ref PixelFormat::R8Unorm there are no implicit guarantees + * for this format. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + R16Snorm = VK_FORMAT_R16_SNORM, + + /** + * Red and green component, normalized signed short. + * + * Compared to @ref PixelFormat::RG8Snorm there are no implicit guarantees + * for this format. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG16Snorm = VK_FORMAT_R16G16_SNORM, + + /** + * RGB, normalized signed short. + * + * Compared to @ref PixelFormat::RG16Snorm / @ref PixelFormat::RGBA16Snorm + * there are no guarantees for this format. + */ + RGB16Snorm = VK_FORMAT_R16G16B16_SNORM, + + /** + * RGBA, normalized signed short. + * + * Compared to @ref PixelFormat::RGBA8Snorm there are no implicit + * guarantees for this format. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RGBA16Snorm = VK_FORMAT_R16G16B16A16_SNORM, + + /** + * Red component, integral unsigned short. + * + * Sampling, blit source/destination and color attachment has guaranteed + * support with optimal tiling. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage. Compared to @ref PixelFormat::R32UI, atomic + * operation support is not guaranteed. + */ + R16UI = VK_FORMAT_R16_UINT, + + /** + * Red and green component, integral unsigned short. + * + * Sampling, blit source/destination and color attachment has guaranteed + * support with optimal tiling. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG16UI = VK_FORMAT_R16G16_UINT, + + /** + * RGB, integral unsigned short. + * + * Compared to @ref PixelFormat::RG16UI / @ref PixelFormat::RGBA16UI there + * are no guarantees for this format. + */ + RGB16UI = VK_FORMAT_R16G16B16_UINT, + + /** + * RGBA, integral unsigned short. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. + */ + RGBA16UI = VK_FORMAT_R16G16B16A16_UINT, + + /** + * Red component, integral signed short. + * + * Sampling, blit source/destination and color attachment has guaranteed + * support with optimal tiling. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage. Compared to @ref PixelFormat::R32I, atomic + * operation support is not guaranteed. + */ + R16I = VK_FORMAT_R16_SINT, + + /** + * Red and green component, integral signed short. + * + * Sampling, blit source/destination and color attachment has guaranteed + * support with optimal tiling. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG16I = VK_FORMAT_R16G16_SINT, + + /** + * RGB, integral signed short. + * + * Compared to @ref PixelFormat::RG16I / @ref PixelFormat::RGBA16I there + * are no guarantees for this format. + */ + RGB16I = VK_FORMAT_R16G16B16_SINT, + + /** + * RGBA, integral signed short. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. + */ + RGBA16I = VK_FORMAT_R16G16B16A16_SINT, + + /** + * Red component, integral unsigned int. + * + * Sampling, blit source/destination, image storage including atomic + * operations and color attachment has guaranteed support with optimal + * tiling. + */ + R32UI = VK_FORMAT_R32_UINT, + + /** + * Red and green component, integral unsigned int. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. + */ + RG32UI = VK_FORMAT_R32G32_UINT, + + /** + * RGB, integral unsigned int. + * + * Compared to @ref PixelFormat::RG32UI / @ref PixelFormat::RGBA32UI there + * are no guarantees for this format. + */ + RGB32UI = VK_FORMAT_R32G32B32_UINT, + + /** + * RGBA, integral unsigned int. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. + */ + RGBA32UI = VK_FORMAT_R32G32B32A32_UINT, + + /** + * Red component, integral signed int. + * + * Sampling, blit source/destination, image storage including atomic + * operations and color attachment has guaranteed support with optimal + * tiling. + */ + R32I = VK_FORMAT_R32_SINT, + + /** + * Red and green component, integral signed int. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. + */ + RG32I = VK_FORMAT_R32G32_SINT, + + /** + * RGB, integral signed int. + * + * Compared to @ref PixelFormat::RG32UI / @ref PixelFormat::RGBA32UI there + * are no guarantees for this format. + */ + RGB32I = VK_FORMAT_R32G32B32_SINT, + + /** + * RGBA, integral signed int. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. + */ + RGBA32I = VK_FORMAT_R32G32B32A32_SINT, + + /** + * Red component, half float. + * + * Sampling, blit source/destination, linear filtering and color attachment + * including blending has guaranteed support with optimal tiling. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + R16F = VK_FORMAT_R16_SFLOAT, + + /** + * Red and green component, half float. + * + * Sampling, blit source/destination, linear filtering and color attachment + * including blending has guaranteed support with optimal tiling. + * @requires_vk_feature @ref DeviceFeature::ShaderStorageImageExtendedFormats + * for image storage + */ + RG16F = VK_FORMAT_R16G16_SFLOAT, + + /** + * RGB, half float. + * + * Compared to @ref PixelFormat::RG16F / @ref PixelFormat::RGBA16F there + * are no guarantees for this format. + */ + RGB16F = VK_FORMAT_R16G16B16_SFLOAT, + + /** + * RGBA, half float. + * + * Sampling, blit source/destination, image storage, linear filtering and + * color attachment including blending has guaranteed support with optimal + * tiling. + */ + RGBA16F = VK_FORMAT_R16G16B16A16_SFLOAT, + + /** + * Red component, float. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. Compared to + * @ref PixelFormat::R16F, linear filtering and blending support is not + * guaranteed. + */ + R32F = VK_FORMAT_R32_SFLOAT, + + /** + * Red and green component, float. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. Compared to + * @ref PixelFormat::RG16F, linear filtering and blending support is not + * guaranteed. + */ + RG32F = VK_FORMAT_R32G32_SFLOAT, + + /** + * RGB, float. + * + * Compared to @ref PixelFormat::RG32F / @ref PixelFormat::RGBA32F there + * are no guarantees for this format. + */ + RGB32F = VK_FORMAT_R32G32B32_SFLOAT, + + /** + * RGBA, float. + * + * Sampling, blit source/destination, image storage and color attachment + * has guaranteed support with optimal tiling. Compared to + * @ref PixelFormat::RGBA16F, linear filtering and blending support is not + * guaranteed. + */ + RGBA32F = VK_FORMAT_R32G32B32A32_SFLOAT, + + /** + * 16-bit unsigned normalized depth. + * + * Sampling, blit source and depth attachment has guaranteed support with + * optimal tiling. + */ + Depth16Unorm = VK_FORMAT_D16_UNORM, + + /** + * 24-bit unsigned normalized depth with 8-bit padding. + * + * Depth attachment support with optimal tiling is guaranteed for either + * this or the @ref PixelFormat::Depth32F format + */ + Depth24Unorm = VK_FORMAT_X8_D24_UNORM_PACK32, + + /** + * 32-bit float depth. + * + * Sampling and blit source has guaranteed support with optimal tiling. + * Depth attachment support with optimal tiling is guaranteed for either + * this or the @ref PixelFormat::Depth24Unorm format. + */ + Depth32F = VK_FORMAT_D32_SFLOAT, + + /** + * 8-bit unsigned integral stencil. + * + * There are no guarantees for this format. + */ + Stencil8UI = VK_FORMAT_S8_UINT, + + /** + * 16-bit unsigned normalized depth with 8-bit unsigned integral stencil. + * + * There are no guarantees for this format. + */ + Depth16UnormStencil8UI = VK_FORMAT_D16_UNORM_S8_UINT, + + /** + * 24-bit unsigned normalized depth with 8-bit unsigned integral stencil. + * + * Depth/stencil attachment support with optimal tiling is guaranteed for + * either this or the @ref PixelFormat::Depth32FStencil8UI format. + */ + Depth24UnormStencil8UI = VK_FORMAT_D24_UNORM_S8_UINT, + + /** + * 32-bit float depth with 8-bit unsigned integral stencil. + * + * Depth/stencil attachment support with optimal tiling is guaranteed for + * either this or the @ref PixelFormat::Depth24UnormStencil8UI format. + */ + Depth32FStencil8UI = VK_FORMAT_D32_SFLOAT_S8_UINT, + + /** + * [S3TC](https://en.wikipedia.org/wiki/S3_Texture_Compression) BC1 + * compressed RGB, normalized unsigned. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc1RGBUnorm = VK_FORMAT_BC1_RGB_UNORM_BLOCK, + + /** + * [S3TC](https://en.wikipedia.org/wiki/S3_Texture_Compression) BC1 + * compressed sRGB, normalized unsigned. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc1RGBSrgb = VK_FORMAT_BC1_RGB_SRGB_BLOCK, + + /** + * S3TC](https://en.wikipedia.org/wiki/S3_Texture_Compression) BC1 + * compressed RGBA, normalized unsigned. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc1RGBAUnorm = VK_FORMAT_BC1_RGBA_UNORM_BLOCK, + + /** + * [S3TC](https://en.wikipedia.org/wiki/S3_Texture_Compression) BC1 + * compressed sRGB + linear alpha, normalized unsigned. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc1RGBASrgb = VK_FORMAT_BC1_RGBA_SRGB_BLOCK, + + /** + * [S3TC](https://en.wikipedia.org/wiki/S3_Texture_Compression) BC2 + * compressed RGBA, normalized unsigned. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc2RGBAUnorm = VK_FORMAT_BC2_UNORM_BLOCK, + + /** + * [S3TC](https://en.wikipedia.org/wiki/S3_Texture_Compression) BC2 + * compressed sRGB + linear alpha, normalized unsigned. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc2RGBASrgb = VK_FORMAT_BC2_SRGB_BLOCK, + + /** + * [S3TC](https://en.wikipedia.org/wiki/S3_Texture_Compression) BC3 + * compressed RGBA, normalized unsigned. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc3RGBAUnorm = VK_FORMAT_BC3_UNORM_BLOCK, + + /** + * [S3TC](https://en.wikipedia.org/wiki/S3_Texture_Compression) BC3 + * compressed sRGB + linear alpha, normalized unsigned. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc3RGBASrgb = VK_FORMAT_BC3_SRGB_BLOCK, + + /** + * [3Dc+](https://en.wikipedia.org/wiki/3Dc#3Dc+) BC4 compressed red + * component, unsigned normalized. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc4RUnorm = VK_FORMAT_BC4_UNORM_BLOCK, + + /** + * [3Dc+](https://en.wikipedia.org/wiki/3Dc#3Dc+) BC4 compressed red + * component, signed normalized. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc4RSnorm = VK_FORMAT_BC4_SNORM_BLOCK, + + /** + * [3Dc](https://en.wikipedia.org/wiki/3Dc) BC5 compressed red and green + * component, unsigned normalized. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc5RGUnorm = VK_FORMAT_BC5_UNORM_BLOCK, + + /** + * [3Dc](https://en.wikipedia.org/wiki/3Dc) BC5 compressed red and green + * component, signed normalized. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc5RGSnorm = VK_FORMAT_BC5_SNORM_BLOCK, + + /** + * [BC6H](https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc6h-format) + * compressed RGB, unsigned float. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc6hRGBUfloat = VK_FORMAT_BC6H_UFLOAT_BLOCK, + + /** + * [BC6H](https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc6h-format) + * compressed RGB, signed float. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc6hRGBSfloat = VK_FORMAT_BC6H_SFLOAT_BLOCK, + + /** + * [BC7](https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc7-format), + * compressed RGBA, unsigned normalized. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc7RGBAUnorm = VK_FORMAT_BC7_UNORM_BLOCK, + + /** + * [BC7](https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc7-format), + * compressed sRGB + linear alpha, unsigned normalized. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionBc + */ + CompressedBc7RGBASrgb = VK_FORMAT_BC7_SRGB_BLOCK, + + /** + * [EAC](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed red component, normalized unsigned 11-bit. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEacR11Unorm = VK_FORMAT_EAC_R11_UNORM_BLOCK, + + /** + * [EAC](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed red component, normalized signed 11-bit. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEacR11Snorm = VK_FORMAT_EAC_R11_SNORM_BLOCK, + + /** + * [EAC](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed red and green component, normalized unsigned 11-bit. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEacRG11Unorm = VK_FORMAT_EAC_R11G11_UNORM_BLOCK, + + /** + * [EAC](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed red and green component, normalized signed 11-bit. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEacRG11Snorm = VK_FORMAT_EAC_R11G11_SNORM_BLOCK, + + /** + * [ETC2](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed RGB, normalized unsigned byte. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEtc2RGB8Unorm = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, + + /** + * [ETC2](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed sRGB, normalized unsigned byte. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEtc2RGB8Srgb = VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, + + /** + * [ETC2](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed RGB, normalized unsigned byte + a single-bit alpha. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEtc2RGB8A1Unorm = VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK, + + /** + * [ETC2](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed sRGB, normalized unsigned byte + a single-bit alpha. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEtc2RGB8A1Srgb = VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK, + + /** + * [ETC2](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed RGBA, normalized unsigned byte. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEtc2RGBA8Unorm = VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, + + /** + * [ETC2](https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC) + * compressed sRGB + linear alpha, normalized unsigned byte. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionEtc2 + */ + CompressedEtc2RGBA8Srgb = VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 4x4 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc4x4RGBAUnorm = VK_FORMAT_ASTC_4x4_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 4x4 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc4x4RGBASrgb = VK_FORMAT_ASTC_4x4_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 4x4 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc4x4RGBAF = VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 5x4 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc5x4RGBAUnorm = VK_FORMAT_ASTC_5x4_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 5x4 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc5x4RGBASrgb = VK_FORMAT_ASTC_5x4_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 5x4 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc5x4RGBAF = VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 5x5 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc5x5RGBAUnorm = VK_FORMAT_ASTC_5x5_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 5x5 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc5x5RGBASrgb = VK_FORMAT_ASTC_5x5_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 5x5 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc5x5RGBAF = VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 6x5 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc6x5RGBAUnorm = VK_FORMAT_ASTC_6x5_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 6x5 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc6x5RGBASrgb = VK_FORMAT_ASTC_6x5_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 6x5 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc6x5RGBAF = VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 6x6 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc6x6RGBAUnorm = VK_FORMAT_ASTC_6x6_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 6x6 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc6x6RGBASrgb = VK_FORMAT_ASTC_6x6_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 6x6 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc6x6RGBAF = VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 8x5 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc8x5RGBAUnorm = VK_FORMAT_ASTC_8x5_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 8x5 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc8x5RGBASrgb = VK_FORMAT_ASTC_8x5_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 8x5 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc8x5RGBAF = VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 8x6 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc8x6RGBAUnorm = VK_FORMAT_ASTC_8x6_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 8x6 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc8x6RGBASrgb = VK_FORMAT_ASTC_8x6_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 8x6 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc8x6RGBAF = VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 8x8 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc8x8RGBAUnorm = VK_FORMAT_ASTC_8x8_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 8x8 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc8x8RGBASrgb = VK_FORMAT_ASTC_8x8_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 8x8 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc8x8RGBAF = VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 10x5 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc10x5RGBAUnorm = VK_FORMAT_ASTC_10x5_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 10x5 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc10x5RGBASrgb = VK_FORMAT_ASTC_10x5_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 10x5 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc10x5RGBAF = VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 10x6 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc10x6RGBAUnorm = VK_FORMAT_ASTC_10x6_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 10x6 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc10x6RGBASrgb = VK_FORMAT_ASTC_10x6_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 10x6 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc10x6RGBAF = VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 10x8 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc10x8RGBAUnorm = VK_FORMAT_ASTC_10x8_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 10x8 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc10x8RGBASrgb = VK_FORMAT_ASTC_10x8_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 10x8 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc10x8RGBAF = VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 10x10 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc10x10RGBAUnorm = VK_FORMAT_ASTC_10x10_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 10x10 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc10x10RGBASrgb = VK_FORMAT_ASTC_10x10_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 10x10 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc10x10RGBAF = VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 12x10 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc12x10RGBAUnorm = VK_FORMAT_ASTC_12x10_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 12x10 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc12x10RGBASrgb = VK_FORMAT_ASTC_12x10_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 12x10 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc12x10RGBAF = VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, normalized unsigned with 12x12 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc12x12RGBAUnorm = VK_FORMAT_ASTC_12x12_UNORM_BLOCK, + + /** + * 2D LDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed sRGB + linear alpha, normalized unsigned with 12x12 blocks. + * + * Sampling, blit source and linear filtering has guaranteed support with + * optimal tiling either for all BC formats, all ETC formats or all ASTC + * LDR formats. + * @see @ref DeviceFeature::TextureCompressionAstcLdr + */ + CompressedAstc12x12RGBASrgb = VK_FORMAT_ASTC_12x12_SRGB_BLOCK, + + /** + * 2D HDR [ASTC](https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression) + * compressed RGBA, float with 12x12 blocks. + * + * @requires_vk_feature @ref DeviceFeature::TextureCompressionAstcHdr + */ + CompressedAstc12x12RGBAF = VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT, + + /* See https://github.com/KhronosGroup/Vulkan-Docs/issues/512#issuecomment-307768667 + for how this maps to actual channels. Ugh. */ + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed RGBA, normalized + * unsigned byte with 2 bits per pixel. + * + * @requires_vk_extension Extension @vk_extension{IMG,format_pvrtc} + */ + CompressedPvrtcRGBA2bppUnorm = VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed sRGB + linear + * alpha, normalized unsigned byte with 2 bits per pixel. + * + * @requires_vk_extension Extension @vk_extension{IMG,format_pvrtc} + */ + CompressedPvrtcRGBA2bppSrgb = VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed RGBA, normalized + * unsigned byte with 4 bits per pixel. + * + * @requires_vk_extension Extension @vk_extension{IMG,format_pvrtc} + */ + CompressedPvrtcRGBA4bppUnorm = VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG, + + /** + * [PVRTC](https://en.wikipedia.org/wiki/PVRTC) compressed sRGB + linear + * alpha, normalized unsigned byte with 4 bits per pixel. + * + * @requires_vk_extension Extension @vk_extension{IMG,format_pvrtc} + */ + CompressedPvrtcRGBA4bppSrgb = VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG, + + /** + * [PVRTC2](https://en.wikipedia.org/wiki/PVRTC) compressed RGBA, + * normalized unsigned byte with 2 bits per pixel. + * + * @requires_vk_extension Extension @vk_extension{IMG,format_pvrtc} + */ + CompressedPvrtc2RGBA2bppUnorm = VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG, + + /** + * [PVRTC2](https://en.wikipedia.org/wiki/PVRTC) compressed sRGB + linear + * alpha, normalized unsigned byte with 2 bits per pixel. + * + * @requires_vk_extension Extension @vk_extension{IMG,format_pvrtc} + */ + CompressedPvrtc2RGBA2bppSrgb = VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG, + + /** + * [PVRTC2](https://en.wikipedia.org/wiki/PVRTC) compressed RGBA, + * normalized unsigned byte with 4 bits per pixel. + * + * @requires_vk_extension Extension @vk_extension{IMG,format_pvrtc} + */ + CompressedPvrtc2RGBA4bppUnorm = VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG, + + /** + * [PVRTC2](https://en.wikipedia.org/wiki/PVRTC) compressed sRGB + linear + * alpha, normalized unsigned byte with 4 bits per pixel. + * + * @requires_vk_extension Extension @vk_extension{IMG,format_pvrtc} + */ + CompressedPvrtc2RGBA4bppSrgb = VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG +}; + +/** @debugoperatorenum{PixelFormat} */ +MAGNUM_VK_EXPORT Debug& operator<<(Debug& debug, PixelFormat value); + +/** +@brief Check availability of a generic pixel format +@m_since_latest + +Returns @cpp false @ce if Vulkan doesn't support such format, @cpp true @ce +otherwise. Moreover, returns @cpp true @ce also for all formats that are +@ref isPixelFormatImplementationSpecific(). The @p format value is expected to +be valid. + +@note Support of some formats depends on presence of a particular Vulkan + extension. Such check is outside of the scope of this function and you are + expected to verify extension availability before using such format. + +@see @ref pixelFormat(Magnum::PixelFormat) +*/ +MAGNUM_VK_EXPORT bool hasPixelFormat(Magnum::PixelFormat format); + +/** +@brief Check availability of a generic compressed pixel format +@m_since_latest + +Returns @cpp false @ce if Vulkan doesn't support such format, @cpp true @ce +otherwise. Moreover, returns @cpp true @ce also for all formats that are +@ref isCompressedPixelFormatImplementationSpecific(). The @p format value is +expected to be valid. + +@note Support of some formats depends on presence of a particular Vulkan + extension. Such check is outside of the scope of this function and you are + expected to verify extension availability before using such format. + +@see @ref pixelFormat(Magnum::CompressedPixelFormat) +*/ +MAGNUM_VK_EXPORT bool hasPixelFormat(Magnum::CompressedPixelFormat format); + +/** +@brief Convert a generic pixel format to Vulkan pixel format +@m_since_latest + +In case @ref isPixelFormatImplementationSpecific() returns @cpp false @ce for +@p format, maps it to a corresponding Vulkan format. In case +@ref isPixelFormatImplementationSpecific() returns @cpp true @ce, assumes +@p format stores a Vulkan-specific format and returns @ref pixelFormatUnwrap() +cast to @ref PixelFormat. + +Not all generic pixel formats have a Vulkan equivalent and this function +expects that given format is available. Use +@ref hasPixelFormat(Magnum::PixelFormat) to query availability of given format. +*/ +MAGNUM_VK_EXPORT PixelFormat pixelFormat(Magnum::PixelFormat format); + +/** +@brief Convert a generic compressed pixel format to Vulkan pixel format +@m_since_latest + +In case @ref isCompressedPixelFormatImplementationSpecific() returns +@cpp false @ce for @p format, maps it to a corresponding Vulkan format. In case +@ref isCompressedPixelFormatImplementationSpecific() returns @cpp true @ce, +assumes @p format stores a Vulkan-specific format and returns +@ref compressedPixelFormatUnwrap() cast to @ref PixelFormat. + +Not all generic pixel formats have a Vulkan equivalent and this function +expects that given format is available. Use +@ref hasPixelFormat(Magnum::CompressedPixelFormat) to query availability of given +format. +*/ +MAGNUM_VK_EXPORT PixelFormat pixelFormat(Magnum::CompressedPixelFormat format); + +}} + +#endif diff --git a/src/Magnum/Vk/RenderPass.cpp b/src/Magnum/Vk/RenderPass.cpp index 5d49bf3e9..2f8bcd922 100644 --- a/src/Magnum/Vk/RenderPass.cpp +++ b/src/Magnum/Vk/RenderPass.cpp @@ -37,14 +37,15 @@ #include "Magnum/Vk/Handle.h" #include "Magnum/Vk/Image.h" #include "Magnum/Vk/Integration.h" +#include "Magnum/Vk/PixelFormat.h" #include "Magnum/Vk/Implementation/DeviceState.h" namespace Magnum { namespace Vk { -AttachmentDescription::AttachmentDescription(const VkFormat format, const AttachmentLoadOperation loadOperation, const AttachmentStoreOperation storeOperation, const ImageLayout initialLayout, const ImageLayout finalLayout, const Int samples, const Flags flags): _description{} { +AttachmentDescription::AttachmentDescription(const PixelFormat format, const AttachmentLoadOperation loadOperation, const AttachmentStoreOperation storeOperation, 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 = format; + _description.format = VkFormat(format); _description.samples = VkSampleCountFlagBits(samples); _description.loadOp = VkAttachmentLoadOp(loadOperation); _description.storeOp = VkAttachmentStoreOp(storeOperation); @@ -52,12 +53,20 @@ AttachmentDescription::AttachmentDescription(const VkFormat format, const Attach _description.finalLayout = VkImageLayout(finalLayout); } -AttachmentDescription::AttachmentDescription(const VkFormat format, const AttachmentLoadOperation loadOperation, const AttachmentStoreOperation storeOperation, const Int samples, const Flags flags): AttachmentDescription{format, loadOperation, storeOperation, ImageLayout::General, ImageLayout::General, samples, flags} {} +AttachmentDescription::AttachmentDescription(const Magnum::PixelFormat 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 VkFormat 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 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 AttachmentLoadOperation loadOperation, const AttachmentStoreOperation storeOperation, const Int samples, const Flags flags): AttachmentDescription{format, loadOperation, storeOperation, ImageLayout::General, ImageLayout::General, samples, flags} {} + +AttachmentDescription::AttachmentDescription(const Magnum::PixelFormat format, const AttachmentLoadOperation loadOperation, const AttachmentStoreOperation storeOperation, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), loadOperation, storeOperation, samples, flags} {} + +AttachmentDescription::AttachmentDescription(const Magnum::CompressedPixelFormat format, const AttachmentLoadOperation loadOperation, const AttachmentStoreOperation storeOperation, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), loadOperation, storeOperation, 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{} { _description.sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2; _description.flags = VkAttachmentDescriptionFlags(flags); - _description.format = format; + _description.format = VkFormat(format); _description.samples = VkSampleCountFlagBits(samples); _description.loadOp = VkAttachmentLoadOp(depthStencilLoadOperation.first); _description.storeOp = VkAttachmentStoreOp(depthStencilStoreOperation.first); @@ -67,7 +76,15 @@ AttachmentDescription::AttachmentDescription(const VkFormat format, const std::p _description.finalLayout = VkImageLayout(finalLayout); } -AttachmentDescription::AttachmentDescription(const VkFormat format, const std::pair depthStencilLoadOperation, const std::pair depthStencilStoreOperation, const Int samples, const Flags flags): AttachmentDescription{format, depthStencilLoadOperation, depthStencilStoreOperation, ImageLayout::General, ImageLayout::General, samples, flags} {} +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::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 PixelFormat format, const std::pair depthStencilLoadOperation, const std::pair depthStencilStoreOperation, const Int samples, const Flags flags): AttachmentDescription{format, depthStencilLoadOperation, depthStencilStoreOperation, ImageLayout::General, ImageLayout::General, samples, flags} {} + +AttachmentDescription::AttachmentDescription(const Magnum::PixelFormat format, const std::pair depthStencilLoadOperation, const std::pair depthStencilStoreOperation, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), depthStencilLoadOperation, depthStencilStoreOperation, samples, flags} {} + +AttachmentDescription::AttachmentDescription(const Magnum::CompressedPixelFormat format, const std::pair depthStencilLoadOperation, const std::pair depthStencilStoreOperation, const Int samples, const Flags flags): AttachmentDescription{pixelFormat(format), depthStencilLoadOperation, depthStencilStoreOperation, samples, flags} {} AttachmentDescription::AttachmentDescription(NoInitT) noexcept {} diff --git a/src/Magnum/Vk/RenderPassCreateInfo.h b/src/Magnum/Vk/RenderPassCreateInfo.h index 181f11b17..e5cf0a6ef 100644 --- a/src/Magnum/Vk/RenderPassCreateInfo.h +++ b/src/Magnum/Vk/RenderPassCreateInfo.h @@ -54,7 +54,7 @@ subpass. enum class AttachmentLoadOperation: Int { /** * Previous contents are preserved. This is the conservative default when - * using the @ref AttachmentDescription::AttachmentDescription(VkFormat, Int, Flags) + * using the @ref AttachmentDescription::AttachmentDescription(PixelFormat, Int, Flags) * constructor. * * This value is also guaranteed to be @cpp 0 @ce, which means you're @@ -105,7 +105,7 @@ treated at the end of a subpass. enum class AttachmentStoreOperation: Int { /** * Generated contents are written to memory. This is the conservative - * default when using the @ref AttachmentDescription::AttachmentDescription(VkFormat, Int, Flags) + * default when using the @ref AttachmentDescription::AttachmentDescription(PixelFormat, Int, Flags) * constructor. * * This value is also guaranteed to be @cpp 0 @ce, which means you're @@ -212,19 +212,27 @@ class MAGNUM_VK_EXPORT AttachmentDescription { * - `initialLayout` * - `finalLayout` * - * See also @ref AttachmentDescription(VkFormat, std::pair, std::pair, ImageLayout, ImageLayout, Int, Flags) + * See also @ref AttachmentDescription(PixelFormat, std::pair, std::pair, ImageLayout, ImageLayout, Int, Flags) * for a constructing a combined depth/stencil attachment description. */ - /*implicit*/ AttachmentDescription(VkFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + /*implicit*/ AttachmentDescription(PixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::PixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::CompressedPixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); /** * @brief Construct with implicit conservative layout * - * Equivalent to calling @ref AttachmentDescription(VkFormat, AttachmentLoadOperation, AttachmentStoreOperation, ImageLayout, ImageLayout, Int, Flags) + * Equivalent to calling @ref AttachmentDescription(PixelFormat, AttachmentLoadOperation, AttachmentStoreOperation, ImageLayout, ImageLayout, Int, Flags) * with both @p initialLayout and @p finalLayout set to * @ref ImageLayout::General. */ - /*implicit*/ AttachmentDescription(VkFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, Int samples = 1, Flags flags = {}); + /*implicit*/ AttachmentDescription(PixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, Int samples = 1, Flags flags = {}); + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::PixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, Int samples = 1, Flags flags = {}); + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::CompressedPixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, Int samples = 1, Flags flags = {}); /** * @brief Construct for a combined depth/stencil attachment @@ -260,26 +268,38 @@ class MAGNUM_VK_EXPORT AttachmentDescription { * @todo Implement @vk_extension{KHR,separate_depth_stencil_layouts} * and provide a pair of layouts as well */ - /*implicit*/ AttachmentDescription(VkFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + /*implicit*/ AttachmentDescription(PixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::PixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::CompressedPixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}); /** * @brief Construct for a combined depth/stencil attachment with implicit conservative layout * - * Equivalent to calling @ref AttachmentDescription(VkFormat, std::pair, std::pair, ImageLayout, ImageLayout, Int, Flags) + * Equivalent to calling @ref AttachmentDescription(PixelFormat, std::pair, std::pair, ImageLayout, ImageLayout, Int, Flags) * with both @p initialLayout and @p finalLayout set to * @ref ImageLayout::General. */ - /*implicit*/ AttachmentDescription(VkFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, Int samples = 1, Flags flags = {}); + /*implicit*/ AttachmentDescription(PixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, Int samples = 1, Flags flags = {}); + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::PixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, Int samples = 1, Flags flags = {}); + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::CompressedPixelFormat format, std::pair depthStencilLoadOperation, std::pair depthStencilStoreOperation, Int samples = 1, Flags flags = {}); /** * @brief Construct with implicit conservative load/store operation and layout * - * Equivalent to calling @ref AttachmentDescription(VkFormat, std::pair, std::pair, ImageLayout, ImageLayout, Int, Flags) + * Equivalent to calling @ref AttachmentDescription(PixelFormat, std::pair, std::pair, ImageLayout, ImageLayout, Int, Flags) * with @ref AttachmentLoadOperation::Load and * @ref AttachmentStoreOperation::Store and both @p initialLayout and * @p finalLayout set to @ref ImageLayout::General. */ - /*implicit*/ AttachmentDescription(VkFormat format, Int samples = 1, Flags flags = {}): AttachmentDescription{format, AttachmentLoadOperation{}, AttachmentStoreOperation{}, samples, flags} {} + /*implicit*/ AttachmentDescription(PixelFormat format, Int samples = 1, Flags flags = {}): AttachmentDescription{format, AttachmentLoadOperation{}, AttachmentStoreOperation{}, samples, flags} {} + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::PixelFormat format, Int samples = 1, Flags flags = {}): AttachmentDescription{format, AttachmentLoadOperation{}, AttachmentStoreOperation{}, samples, flags} {} + /** @overload */ + /*implicit*/ AttachmentDescription(Magnum::CompressedPixelFormat format, Int samples = 1, Flags flags = {}): AttachmentDescription{format, AttachmentLoadOperation{}, AttachmentStoreOperation{}, samples, flags} {} /** * @brief Construct without initializing the contents diff --git a/src/Magnum/Vk/Test/CMakeLists.txt b/src/Magnum/Vk/Test/CMakeLists.txt index 69c6958c6..1fefbce54 100644 --- a/src/Magnum/Vk/Test/CMakeLists.txt +++ b/src/Magnum/Vk/Test/CMakeLists.txt @@ -42,6 +42,7 @@ corrade_add_test(VkInstanceTest InstanceTest.cpp LIBRARIES MagnumVk) corrade_add_test(VkIntegrationTest IntegrationTest.cpp LIBRARIES MagnumVk) corrade_add_test(VkLayerPropertiesTest LayerPropertiesTest.cpp LIBRARIES MagnumVk) corrade_add_test(VkMemoryTest MemoryTest.cpp LIBRARIES MagnumVkTestLib) +corrade_add_test(VkPixelFormatTest PixelFormatTest.cpp LIBRARIES MagnumVkTestLib) corrade_add_test(VkQueueTest QueueTest.cpp LIBRARIES MagnumVk) corrade_add_test(VkResultTest ResultTest.cpp LIBRARIES MagnumVk) corrade_add_test(VkRenderPassTest RenderPassTest.cpp LIBRARIES MagnumVkTestLib) diff --git a/src/Magnum/Vk/Test/EnumsTest.cpp b/src/Magnum/Vk/Test/EnumsTest.cpp index b0c95ae87..bc51dd5ee 100644 --- a/src/Magnum/Vk/Test/EnumsTest.cpp +++ b/src/Magnum/Vk/Test/EnumsTest.cpp @@ -52,16 +52,6 @@ struct EnumsTest: TestSuite::Tester { void mapVkFormatVertexFormatUnsupported(); void mapVkFormatVertexFormatInvalid(); - void mapVkFormatPixelFormat(); - void mapVkFormatPixelFormatImplementationSpecific(); - void mapVkFormatPixelFormatUnsupported(); - void mapVkFormatPixelFormatInvalid(); - - void mapVkFormatCompressedPixelFormat(); - void mapVkFormatCompressedPixelFormatImplementationSpecific(); - void mapVkFormatCompressedPixelFormatUnsupported(); - void mapVkFormatCompressedPixelFormatInvalid(); - void mapVkFilter(); void mapVkFilterInvalid(); @@ -89,16 +79,6 @@ EnumsTest::EnumsTest() { &EnumsTest::mapVkFormatVertexFormatUnsupported, &EnumsTest::mapVkFormatVertexFormatInvalid, - &EnumsTest::mapVkFormatPixelFormat, - &EnumsTest::mapVkFormatPixelFormatImplementationSpecific, - &EnumsTest::mapVkFormatPixelFormatUnsupported, - &EnumsTest::mapVkFormatPixelFormatInvalid, - - &EnumsTest::mapVkFormatCompressedPixelFormat, - &EnumsTest::mapVkFormatCompressedPixelFormatImplementationSpecific, - &EnumsTest::mapVkFormatCompressedPixelFormatUnsupported, - &EnumsTest::mapVkFormatCompressedPixelFormatInvalid, - &EnumsTest::mapVkFilter, &EnumsTest::mapVkFilterInvalid, @@ -365,205 +345,6 @@ void EnumsTest::mapVkFormatVertexFormatInvalid() { "Vk::vkFormat(): invalid format VertexFormat(0x123)\n"); } -void EnumsTest::mapVkFormatPixelFormat() { - /* Touchstone verification */ - CORRADE_VERIFY(hasVkFormat(Magnum::PixelFormat::RGBA8Unorm)); - CORRADE_COMPARE(vkFormat(Magnum::PixelFormat::RGBA8Unorm), VK_FORMAT_R8G8B8A8_UNORM); - - /* This goes through the first 16 bits, which should be enough. Going - through 32 bits takes 8 seconds, too much. */ - UnsignedInt firstUnhandled = 0xffff; - UnsignedInt nextHandled = 1; /* 0 is an invalid format */ - for(UnsignedInt i = 1; i <= 0xffff; ++i) { - const auto format = Magnum::PixelFormat(i); - /* Each case verifies: - - that the entries are ordered by number by comparing a function to - expected result (so insertion here is done in proper place) - - that there was no gap (unhandled value inside the range) - - that a particular pixel format maps to a particular vkFormat */ - #ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic error "-Wswitch" - #endif - switch(format) { - #define _c(format, expectedFormat) \ - case Magnum::PixelFormat::format: \ - CORRADE_COMPARE(nextHandled, i); \ - CORRADE_COMPARE(firstUnhandled, 0xffff); \ - CORRADE_VERIFY(hasVkFormat(Magnum::PixelFormat::format)); \ - CORRADE_COMPARE(vkFormat(Magnum::PixelFormat::format), VK_FORMAT_ ## expectedFormat); \ - ++nextHandled; \ - continue; - #define _s(format) \ - case Magnum::PixelFormat::format: { \ - CORRADE_COMPARE(nextHandled, i); \ - CORRADE_COMPARE(firstUnhandled, 0xffff); \ - CORRADE_VERIFY(!hasVkFormat(Magnum::PixelFormat::format)); \ - std::ostringstream out; \ - { /* Redirected otherwise graceful assert would abort */ \ - Error redirectError{&out}; \ - vkFormat(Magnum::PixelFormat::format); \ - } \ - Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ - ++nextHandled; \ - continue; \ - } - #include "Magnum/Vk/Implementation/pixelFormatMapping.hpp" - #undef _s - #undef _c - } - #ifdef __GNUC__ - #pragma GCC diagnostic pop - #endif - - /* Not handled by any value, remember -- we might either be at the end - of the enum range (which is okay) or some value might be unhandled - here */ - firstUnhandled = i; - } - - CORRADE_COMPARE(firstUnhandled, 0xffff); -} - -void EnumsTest::mapVkFormatPixelFormatImplementationSpecific() { - CORRADE_VERIFY(hasVkFormat(Magnum::pixelFormatWrap(VK_FORMAT_A8B8G8R8_SINT_PACK32))); - CORRADE_COMPARE(vkFormat(Magnum::pixelFormatWrap(VK_FORMAT_A8B8G8R8_SINT_PACK32)), - VK_FORMAT_A8B8G8R8_SINT_PACK32); -} - -void EnumsTest::mapVkFormatPixelFormatUnsupported() { - #ifdef CORRADE_NO_ASSERT - CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); - #endif - - #if 1 - CORRADE_SKIP("All pixel formats are supported."); - #else - std::ostringstream out; - Error redirectError{&out}; - - vkFormat(Magnum::PixelFormat::RGB16UI); - CORRADE_COMPARE(out.str(), "Vk::vkFormat(): unsupported format PixelFormat::RGB16UI\n"); - #endif -} - -void EnumsTest::mapVkFormatPixelFormatInvalid() { - #ifdef CORRADE_NO_ASSERT - CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); - #endif - - std::ostringstream out; - Error redirectError{&out}; - - hasVkFormat(Magnum::PixelFormat{}); - hasVkFormat(Magnum::PixelFormat(0x123)); - vkFormat(Magnum::PixelFormat{}); - vkFormat(Magnum::PixelFormat(0x123)); - CORRADE_COMPARE(out.str(), - "Vk::hasVkFormat(): invalid format PixelFormat(0x0)\n" - "Vk::hasVkFormat(): invalid format PixelFormat(0x123)\n" - "Vk::vkFormat(): invalid format PixelFormat(0x0)\n" - "Vk::vkFormat(): invalid format PixelFormat(0x123)\n"); -} - -void EnumsTest::mapVkFormatCompressedPixelFormat() { - /* Touchstone verification */ - CORRADE_VERIFY(hasVkFormat(Magnum::CompressedPixelFormat::Bc1RGBAUnorm)); - CORRADE_COMPARE(vkFormat(Magnum::CompressedPixelFormat::Bc1RGBAUnorm), VK_FORMAT_BC1_RGBA_UNORM_BLOCK); - - /* This goes through the first 16 bits, which should be enough. Going - through 32 bits takes 8 seconds, too much. */ - UnsignedInt firstUnhandled = 0xffff; - UnsignedInt nextHandled = 1; /* 0 is an invalid format */ - for(UnsignedInt i = 1; i <= 0xffff; ++i) { - const auto format = Magnum::CompressedPixelFormat(i); - /* Each case verifies: - - that the entries are ordered by number by comparing a function to - expected result (so insertion here is done in proper place) - - that there was no gap (unhandled value inside the range) - - that a particular pixel format maps to a particular VkFormat */ - #ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic error "-Wswitch" - #endif - switch(format) { - #define _c(format, expectedFormat) \ - case Magnum::CompressedPixelFormat::format: \ - CORRADE_COMPARE(nextHandled, i); \ - CORRADE_COMPARE(firstUnhandled, 0xffff); \ - CORRADE_VERIFY(hasVkFormat(Magnum::CompressedPixelFormat::format)); \ - CORRADE_COMPARE(vkFormat(Magnum::CompressedPixelFormat::format), VK_FORMAT_ ## expectedFormat); \ - ++nextHandled; \ - continue; - #define _s(format) \ - case Magnum::CompressedPixelFormat::format: { \ - CORRADE_COMPARE(nextHandled, i); \ - CORRADE_COMPARE(firstUnhandled, 0xffff); \ - CORRADE_VERIFY(!hasVkFormat(Magnum::CompressedPixelFormat::format)); \ - std::ostringstream out; \ - { /* Redirected otherwise graceful assert would abort */ \ - Error redirectError{&out}; \ - vkFormat(Magnum::CompressedPixelFormat::format); \ - } \ - Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ - ++nextHandled; \ - continue; \ - } - #include "Magnum/Vk/Implementation/compressedPixelFormatMapping.hpp" - #undef _s - #undef _c - } - #ifdef __GNUC__ - #pragma GCC diagnostic pop - #endif - - /* Not handled by any value, remember -- we might either be at the end - of the enum range (which is okay) or some value might be unhandled - here */ - firstUnhandled = i; - } - - CORRADE_COMPARE(firstUnhandled, 0xffff); -} - -void EnumsTest::mapVkFormatCompressedPixelFormatImplementationSpecific() { - CORRADE_VERIFY(hasVkFormat(Magnum::compressedPixelFormatWrap(VK_FORMAT_ASTC_10x6_UNORM_BLOCK))); - CORRADE_COMPARE(vkFormat(Magnum::compressedPixelFormatWrap(VK_FORMAT_ASTC_10x6_UNORM_BLOCK)), - VK_FORMAT_ASTC_10x6_UNORM_BLOCK); -} - -void EnumsTest::mapVkFormatCompressedPixelFormatUnsupported() { - #ifdef CORRADE_NO_ASSERT - CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); - #endif - - CORRADE_VERIFY(!hasVkFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm)); - - std::ostringstream out; - Error redirectError{&out}; - vkFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm); - CORRADE_COMPARE(out.str(), "Vk::vkFormat(): unsupported format CompressedPixelFormat::Astc3x3x3RGBAUnorm\n"); -} - -void EnumsTest::mapVkFormatCompressedPixelFormatInvalid() { - #ifdef CORRADE_NO_ASSERT - CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); - #endif - - std::ostringstream out; - Error redirectError{&out}; - - hasVkFormat(Magnum::CompressedPixelFormat{}); - hasVkFormat(Magnum::CompressedPixelFormat(0x123)); - vkFormat(Magnum::CompressedPixelFormat{}); - vkFormat(Magnum::CompressedPixelFormat(0x123)); - CORRADE_COMPARE(out.str(), - "Vk::hasVkFormat(): invalid format CompressedPixelFormat(0x0)\n" - "Vk::hasVkFormat(): invalid format CompressedPixelFormat(0x123)\n" - "Vk::vkFormat(): invalid format CompressedPixelFormat(0x0)\n" - "Vk::vkFormat(): invalid format CompressedPixelFormat(0x123)\n"); -} - void EnumsTest::mapVkFilter() { CORRADE_COMPARE(vkFilter(SamplerFilter::Nearest), VK_FILTER_NEAREST); CORRADE_COMPARE(vkFilter(SamplerFilter::Linear), VK_FILTER_LINEAR); diff --git a/src/Magnum/Vk/Test/FramebufferVkTest.cpp b/src/Magnum/Vk/Test/FramebufferVkTest.cpp index f0727ba9b..c16a2a91a 100644 --- a/src/Magnum/Vk/Test/FramebufferVkTest.cpp +++ b/src/Magnum/Vk/Test/FramebufferVkTest.cpp @@ -28,6 +28,7 @@ #include "Magnum/Vk/FramebufferCreateInfo.h" #include "Magnum/Vk/ImageCreateInfo.h" #include "Magnum/Vk/ImageViewCreateInfo.h" +#include "Magnum/Vk/PixelFormat.h" #include "Magnum/Vk/RenderPassCreateInfo.h" #include "Magnum/Vk/Result.h" #include "Magnum/Vk/VulkanTester.h" @@ -54,9 +55,9 @@ void FramebufferVkTest::construct() { /* Using a depth attachment as well even though not strictly necessary to catch potential unexpected bugs */ Image color{device(), ImageCreateInfo2D{ImageUsage::ColorAttachment, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; Image depth{device(), ImageCreateInfo2D{ImageUsage::DepthStencilAttachment, - VK_FORMAT_D24_UNORM_S8_UINT, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::Depth24UnormStencil8UI, {256, 256}, 1}, MemoryFlag::DeviceLocal}; ImageView colorView{device(), ImageViewCreateInfo2D{color}}; ImageView depthView{device(), ImageViewCreateInfo2D{depth}}; @@ -87,7 +88,7 @@ void FramebufferVkTest::construct() { void FramebufferVkTest::constructMove() { Image color{device(), ImageCreateInfo2D{ImageUsage::ColorAttachment, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; ImageView colorView{device(), ImageViewCreateInfo2D{color}}; RenderPass renderPass{device(), RenderPassCreateInfo{} .setAttachments({color.format()}) @@ -119,7 +120,7 @@ void FramebufferVkTest::constructMove() { void FramebufferVkTest::wrap() { Image color{device(), ImageCreateInfo2D{ImageUsage::ColorAttachment, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; ImageView colorView{device(), ImageViewCreateInfo2D{color}}; RenderPass renderPass{device(), RenderPassCreateInfo{} .setAttachments({color.format()}) diff --git a/src/Magnum/Vk/Test/ImageTest.cpp b/src/Magnum/Vk/Test/ImageTest.cpp index da952d5c6..91a57a1ae 100644 --- a/src/Magnum/Vk/Test/ImageTest.cpp +++ b/src/Magnum/Vk/Test/ImageTest.cpp @@ -28,22 +28,26 @@ #include #include +#include "Magnum/PixelFormat.h" #include "Magnum/Vk/ImageCreateInfo.h" #include "Magnum/Vk/Integration.h" +#include "Magnum/Vk/PixelFormat.h" + +#include "Magnum/Vk/Test/pixelFormatTraits.h" namespace Magnum { namespace Vk { namespace Test { namespace { struct ImageTest: TestSuite::Tester { explicit ImageTest(); - void createInfoConstruct(); - void createInfoConstruct1D(); - void createInfoConstruct2D(); - void createInfoConstruct3D(); - void createInfoConstruct1DArray(); - void createInfoConstruct2DArray(); - void createInfoConstructCubeMap(); - void createInfoConstructCubeMapArray(); + template void createInfoConstruct(); + template void createInfoConstruct1D(); + template void createInfoConstruct2D(); + template void createInfoConstruct3D(); + template void createInfoConstruct1DArray(); + template void createInfoConstruct2DArray(); + template void createInfoConstructCubeMap(); + template void createInfoConstructCubeMapArray(); void createInfoConstructNoInit(); void createInfoConstructFromVk(); @@ -54,14 +58,30 @@ struct ImageTest: TestSuite::Tester { }; ImageTest::ImageTest() { - addTests({&ImageTest::createInfoConstruct, - &ImageTest::createInfoConstruct1D, - &ImageTest::createInfoConstruct2D, - &ImageTest::createInfoConstruct3D, - &ImageTest::createInfoConstruct1DArray, - &ImageTest::createInfoConstruct2DArray, - &ImageTest::createInfoConstructCubeMap, - &ImageTest::createInfoConstructCubeMapArray, + addTests({&ImageTest::createInfoConstruct, + &ImageTest::createInfoConstruct, + &ImageTest::createInfoConstruct, + &ImageTest::createInfoConstruct1D, + &ImageTest::createInfoConstruct1D, + &ImageTest::createInfoConstruct1D, + &ImageTest::createInfoConstruct2D, + &ImageTest::createInfoConstruct2D, + &ImageTest::createInfoConstruct2D, + &ImageTest::createInfoConstruct3D, + &ImageTest::createInfoConstruct3D, + &ImageTest::createInfoConstruct3D, + &ImageTest::createInfoConstruct1DArray, + &ImageTest::createInfoConstruct1DArray, + &ImageTest::createInfoConstruct1DArray, + &ImageTest::createInfoConstruct2DArray, + &ImageTest::createInfoConstruct2DArray, + &ImageTest::createInfoConstruct2DArray, + &ImageTest::createInfoConstructCubeMap, + &ImageTest::createInfoConstructCubeMap, + &ImageTest::createInfoConstructCubeMap, + &ImageTest::createInfoConstructCubeMapArray, + &ImageTest::createInfoConstructCubeMapArray, + &ImageTest::createInfoConstructCubeMapArray, &ImageTest::createInfoConstructNoInit, &ImageTest::createInfoConstructFromVk, @@ -71,11 +91,13 @@ ImageTest::ImageTest() { &ImageTest::dedicatedMemoryNotDedicated}); } -void ImageTest::createInfoConstruct() { - ImageCreateInfo info{VK_IMAGE_TYPE_2D, ImageUsage::Sampled, VK_FORMAT_R8G8B8A8_UNORM, {256, 128, 1}, 6, 8, 16, ImageLayout::Undefined, ImageCreateInfo::Flag::CubeCompatible}; +template void ImageTest::createInfoConstruct() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + ImageCreateInfo info{VK_IMAGE_TYPE_2D, ImageUsage::Sampled, PixelFormatTraits::format(), {256, 128, 1}, 6, 8, 16, ImageLayout::Undefined, ImageCreateInfo::Flag::CubeCompatible}; CORRADE_COMPARE(info->flags, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT); CORRADE_COMPARE(info->imageType, VK_IMAGE_TYPE_2D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(Vector3i(info->extent), (Vector3i{256, 128, 1})); CORRADE_COMPARE(info->mipLevels, 8); CORRADE_COMPARE(info->arrayLayers, 6); @@ -86,11 +108,13 @@ void ImageTest::createInfoConstruct() { CORRADE_COMPARE(info->initialLayout, VK_IMAGE_LAYOUT_UNDEFINED); } -void ImageTest::createInfoConstruct1D() { - ImageCreateInfo1D info{ImageUsage::Storage, VK_FORMAT_R8G8B8A8_UNORM, 256, 8, 16, ImageCreateInfo::Flag::MutableFormat}; +template void ImageTest::createInfoConstruct1D() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + ImageCreateInfo1D info{ImageUsage::Storage, PixelFormatTraits::format(), 256, 8, 16, ImageCreateInfo::Flag::MutableFormat}; CORRADE_COMPARE(info->flags, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT); CORRADE_COMPARE(info->imageType, VK_IMAGE_TYPE_1D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(Vector3i(info->extent), (Vector3i{256, 1, 1})); CORRADE_COMPARE(info->mipLevels, 8); CORRADE_COMPARE(info->arrayLayers, 1); @@ -98,11 +122,13 @@ void ImageTest::createInfoConstruct1D() { CORRADE_COMPARE(info->usage, VK_IMAGE_USAGE_STORAGE_BIT); } -void ImageTest::createInfoConstruct2D() { - ImageCreateInfo2D info{ImageUsage::TransferDestination, VK_FORMAT_R8G8B8A8_UNORM, {256, 64}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; +template void ImageTest::createInfoConstruct2D() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + ImageCreateInfo2D info{ImageUsage::TransferDestination, PixelFormatTraits::format(), {256, 64}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; CORRADE_COMPARE(info->flags, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT); CORRADE_COMPARE(info->imageType, VK_IMAGE_TYPE_2D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(Vector3i(info->extent), (Vector3i{256, 64, 1})); CORRADE_COMPARE(info->mipLevels, 8); CORRADE_COMPARE(info->arrayLayers, 1); @@ -110,11 +136,13 @@ void ImageTest::createInfoConstruct2D() { CORRADE_COMPARE(info->usage, VK_IMAGE_USAGE_TRANSFER_DST_BIT); } -void ImageTest::createInfoConstruct3D() { - ImageCreateInfo3D info{ImageUsage::InputAttachment, VK_FORMAT_R8G8B8A8_UNORM, {256, 64, 32}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; +template void ImageTest::createInfoConstruct3D() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + ImageCreateInfo3D info{ImageUsage::InputAttachment, PixelFormatTraits::format(), {256, 64, 32}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; CORRADE_COMPARE(info->flags, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT); CORRADE_COMPARE(info->imageType, VK_IMAGE_TYPE_3D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(Vector3i(info->extent), (Vector3i{256, 64, 32})); CORRADE_COMPARE(info->mipLevels, 8); CORRADE_COMPARE(info->arrayLayers, 1); @@ -122,11 +150,13 @@ void ImageTest::createInfoConstruct3D() { CORRADE_COMPARE(info->usage, VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); } -void ImageTest::createInfoConstruct1DArray() { - ImageCreateInfo1DArray info{ImageUsage::TransferDestination, VK_FORMAT_R8G8B8A8_UNORM, {256, 64}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; +template void ImageTest::createInfoConstruct1DArray() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + ImageCreateInfo1DArray info{ImageUsage::TransferDestination, PixelFormatTraits::format(), {256, 64}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; CORRADE_COMPARE(info->flags, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT); CORRADE_COMPARE(info->imageType, VK_IMAGE_TYPE_1D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(Vector3i(info->extent), (Vector3i{256, 1, 1})); CORRADE_COMPARE(info->mipLevels, 8); CORRADE_COMPARE(info->arrayLayers, 64); @@ -134,11 +164,13 @@ void ImageTest::createInfoConstruct1DArray() { CORRADE_COMPARE(info->usage, VK_IMAGE_USAGE_TRANSFER_DST_BIT); } -void ImageTest::createInfoConstruct2DArray() { - ImageCreateInfo2DArray info{ImageUsage::TransferDestination, VK_FORMAT_R8G8B8A8_UNORM, {256, 64, 32}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; +template void ImageTest::createInfoConstruct2DArray() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + ImageCreateInfo2DArray info{ImageUsage::TransferDestination, PixelFormatTraits::format(), {256, 64, 32}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; CORRADE_COMPARE(info->flags, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT); CORRADE_COMPARE(info->imageType, VK_IMAGE_TYPE_2D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(Vector3i(info->extent), (Vector3i{256, 64, 1})); CORRADE_COMPARE(info->mipLevels, 8); CORRADE_COMPARE(info->arrayLayers, 32); @@ -146,11 +178,13 @@ void ImageTest::createInfoConstruct2DArray() { CORRADE_COMPARE(info->usage, VK_IMAGE_USAGE_TRANSFER_DST_BIT); } -void ImageTest::createInfoConstructCubeMap() { - ImageCreateInfoCubeMap info{ImageUsage::TransferDestination, VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; +template void ImageTest::createInfoConstructCubeMap() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + ImageCreateInfoCubeMap info{ImageUsage::TransferDestination, PixelFormatTraits::format(), {256, 256}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; CORRADE_COMPARE(info->flags, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT|VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT); CORRADE_COMPARE(info->imageType, VK_IMAGE_TYPE_2D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(Vector3i(info->extent), (Vector3i{256, 256, 1})); CORRADE_COMPARE(info->mipLevels, 8); CORRADE_COMPARE(info->arrayLayers, 6); @@ -158,11 +192,13 @@ void ImageTest::createInfoConstructCubeMap() { CORRADE_COMPARE(info->usage, VK_IMAGE_USAGE_TRANSFER_DST_BIT); } -void ImageTest::createInfoConstructCubeMapArray() { - ImageCreateInfoCubeMapArray info{ImageUsage::TransferDestination, VK_FORMAT_R8G8B8A8_UNORM, {256, 256, 36}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; +template void ImageTest::createInfoConstructCubeMapArray() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + ImageCreateInfoCubeMapArray info{ImageUsage::TransferDestination, PixelFormatTraits::format(), {256, 256, 36}, 8, 16, ImageCreateInfo::Flag::MutableFormat}; CORRADE_COMPARE(info->flags, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT|VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT); CORRADE_COMPARE(info->imageType, VK_IMAGE_TYPE_2D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(Vector3i(info->extent), (Vector3i{256, 256, 1})); CORRADE_COMPARE(info->mipLevels, 8); CORRADE_COMPARE(info->arrayLayers, 36); diff --git a/src/Magnum/Vk/Test/ImageViewTest.cpp b/src/Magnum/Vk/Test/ImageViewTest.cpp index 5cfd3fb83..024a75371 100644 --- a/src/Magnum/Vk/Test/ImageViewTest.cpp +++ b/src/Magnum/Vk/Test/ImageViewTest.cpp @@ -32,27 +32,30 @@ #include "Magnum/Vk/Image.h" #include "Magnum/Vk/ImageViewCreateInfo.h" +#include "Magnum/Vk/Test/pixelFormatTraits.h" + namespace Magnum { namespace Vk { namespace Test { namespace { struct ImageViewTest: TestSuite::Tester { explicit ImageViewTest(); - void createInfoConstruct(); + template void createInfoConstruct(); void createInfoConstructFromImage(); void createInfoConstructFromImageFormatUknown(); - void createInfoConstruct1D(); + template void createInfoConstruct1D(); void createInfoConstruct1DFromImage(); - void createInfoConstruct2D(); + template void createInfoConstruct2D(); + void createInfoConstruct2DAspect(); void createInfoConstruct2DFromImage(); - void createInfoConstruct3D(); + template void createInfoConstruct3D(); void createInfoConstruct3DFromImage(); - void createInfoConstruct1DArray(); + template void createInfoConstruct1DArray(); void createInfoConstruct1DArrayFromImage(); - void createInfoConstruct2DArray(); + template void createInfoConstruct2DArray(); void createInfoConstruct2DArrayFromImage(); - void createInfoConstructCubeMap(); + template void createInfoConstructCubeMap(); void createInfoConstructCubeMapFromImage(); - void createInfoConstructCubeMapArray(); + template void createInfoConstructCubeMapArray(); void createInfoConstructCubeMapArrayFromImage(); void createInfoConstructNoInit(); void createInfoConstructFromVk(); @@ -63,35 +66,52 @@ struct ImageViewTest: TestSuite::Tester { const struct { const char* name; - VkFormat format; + PixelFormat format; VkImageAspectFlags aspect; } View2DFormatData[] { - {"color", VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_ASPECT_COLOR_BIT}, - {"depth + stencil", VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT|VK_IMAGE_ASPECT_STENCIL_BIT}, - {"depth", VK_FORMAT_D16_UNORM, VK_IMAGE_ASPECT_DEPTH_BIT}, - {"stencil", VK_FORMAT_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT} + {"color", PixelFormat::RGBA8Unorm, VK_IMAGE_ASPECT_COLOR_BIT}, + {"depth + stencil", PixelFormat::Depth32FStencil8UI, VK_IMAGE_ASPECT_DEPTH_BIT|VK_IMAGE_ASPECT_STENCIL_BIT}, + {"depth", PixelFormat::Depth16Unorm, VK_IMAGE_ASPECT_DEPTH_BIT}, + {"stencil", PixelFormat::Stencil8UI, VK_IMAGE_ASPECT_STENCIL_BIT} }; ImageViewTest::ImageViewTest() { - addTests({&ImageViewTest::createInfoConstruct, + addTests({&ImageViewTest::createInfoConstruct, + &ImageViewTest::createInfoConstruct, + &ImageViewTest::createInfoConstruct, &ImageViewTest::createInfoConstructFromImage, &ImageViewTest::createInfoConstructFromImageFormatUknown, - &ImageViewTest::createInfoConstruct1D, - &ImageViewTest::createInfoConstruct1DFromImage}); - - addInstancedTests({&ImageViewTest::createInfoConstruct2D}, + &ImageViewTest::createInfoConstruct1D, + &ImageViewTest::createInfoConstruct1D, + &ImageViewTest::createInfoConstruct1D, + &ImageViewTest::createInfoConstruct1DFromImage, + &ImageViewTest::createInfoConstruct2D, + &ImageViewTest::createInfoConstruct2D, + &ImageViewTest::createInfoConstruct2D}); + + addInstancedTests({&ImageViewTest::createInfoConstruct2DAspect}, Containers::arraySize(View2DFormatData)); addTests({&ImageViewTest::createInfoConstruct2DFromImage, - &ImageViewTest::createInfoConstruct3D, + &ImageViewTest::createInfoConstruct3D, + &ImageViewTest::createInfoConstruct3D, + &ImageViewTest::createInfoConstruct3D, &ImageViewTest::createInfoConstruct3DFromImage, - &ImageViewTest::createInfoConstruct1DArray, + &ImageViewTest::createInfoConstruct1DArray, + &ImageViewTest::createInfoConstruct1DArray, + &ImageViewTest::createInfoConstruct1DArray, &ImageViewTest::createInfoConstruct1DArrayFromImage, - &ImageViewTest::createInfoConstruct2DArray, + &ImageViewTest::createInfoConstruct2DArray, + &ImageViewTest::createInfoConstruct2DArray, + &ImageViewTest::createInfoConstruct2DArray, &ImageViewTest::createInfoConstruct2DArrayFromImage, - &ImageViewTest::createInfoConstructCubeMap, + &ImageViewTest::createInfoConstructCubeMap, + &ImageViewTest::createInfoConstructCubeMap, + &ImageViewTest::createInfoConstructCubeMap, &ImageViewTest::createInfoConstructCubeMapFromImage, - &ImageViewTest::createInfoConstructCubeMapArray, + &ImageViewTest::createInfoConstructCubeMapArray, + &ImageViewTest::createInfoConstructCubeMapArray, + &ImageViewTest::createInfoConstructCubeMapArray, &ImageViewTest::createInfoConstructCubeMapArrayFromImage, &ImageViewTest::createInfoConstructNoInit, &ImageViewTest::createInfoConstructFromVk, @@ -102,13 +122,13 @@ ImageViewTest::ImageViewTest() { const VkImage imageHandle{reinterpret_cast(0xdeadbeef)}; -void ImageViewTest::createInfoConstruct() { +template void ImageViewTest::createInfoConstruct() { /** @todo use a real flag once it exists */ - ImageViewCreateInfo info{VK_IMAGE_VIEW_TYPE_2D, imageHandle, VK_FORMAT_R8G8B8A8_SRGB, 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; + ImageViewCreateInfo info{VK_IMAGE_VIEW_TYPE_2D, imageHandle, PixelFormatTraits::format(), 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; CORRADE_COMPARE(info->flags, VK_NOT_READY); CORRADE_COMPARE(info->image, imageHandle); CORRADE_COMPARE(info->viewType, VK_IMAGE_VIEW_TYPE_2D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_SRGB); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(info->subresourceRange.aspectMask, VK_IMAGE_ASPECT_COLOR_BIT); CORRADE_COMPARE(info->subresourceRange.baseArrayLayer, 3); CORRADE_COMPARE(info->subresourceRange.layerCount, 5); @@ -118,7 +138,7 @@ void ImageViewTest::createInfoConstruct() { void ImageViewTest::createInfoConstructFromImage() { Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_R8G8B8A8_SRGB); + Image image = Image::wrap(device, imageHandle, PixelFormat::RGBA8Srgb); /** @todo use a real flag once it exists */ ImageViewCreateInfo info{VK_IMAGE_VIEW_TYPE_2D, image, 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; @@ -139,7 +159,7 @@ void ImageViewTest::createInfoConstructFromImageFormatUknown() { #endif Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_UNDEFINED); + Image image = Image::wrap(device, imageHandle, PixelFormat{}); std::ostringstream out; Error redirectError{&out}; @@ -148,13 +168,15 @@ void ImageViewTest::createInfoConstructFromImageFormatUknown() { "Vk::ImageViewCreateInfo: the image has unknown format, you have to specify it explicitly\n"); } -void ImageViewTest::createInfoConstruct1D() { +template void ImageViewTest::createInfoConstruct1D() { + setTestCaseTemplateName(PixelFormatTraits::name()); + /** @todo use a real flag once it exists */ - ImageViewCreateInfo1D info{imageHandle, VK_FORMAT_R8G8B8A8_SRGB, 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; + ImageViewCreateInfo1D info{imageHandle, PixelFormatTraits::format(), 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; CORRADE_COMPARE(info->flags, VK_NOT_READY); CORRADE_COMPARE(info->image, imageHandle); CORRADE_COMPARE(info->viewType, VK_IMAGE_VIEW_TYPE_1D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_SRGB); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(info->subresourceRange.aspectMask, VK_IMAGE_ASPECT_COLOR_BIT); CORRADE_COMPARE(info->subresourceRange.baseArrayLayer, 3); CORRADE_COMPARE(info->subresourceRange.layerCount, 1); @@ -164,7 +186,7 @@ void ImageViewTest::createInfoConstruct1D() { void ImageViewTest::createInfoConstruct1DFromImage() { Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_R8G8B8A8_SRGB); + Image image = Image::wrap(device, imageHandle, PixelFormat::RGBA8Srgb); /** @todo use a real flag once it exists */ ImageViewCreateInfo1D info{image, 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; @@ -179,26 +201,34 @@ void ImageViewTest::createInfoConstruct1DFromImage() { CORRADE_COMPARE(info->subresourceRange.levelCount, 9); } -void ImageViewTest::createInfoConstruct2D() { - auto&& data = View2DFormatData[testCaseInstanceId()]; - setTestCaseDescription(data.name); +template void ImageViewTest::createInfoConstruct2D() { + setTestCaseTemplateName(PixelFormatTraits::name()); /** @todo use a real flag once it exists */ - ImageViewCreateInfo2D info{imageHandle, data.format, 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; + ImageViewCreateInfo2D info{imageHandle, PixelFormatTraits::format(), 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; CORRADE_COMPARE(info->flags, VK_NOT_READY); CORRADE_COMPARE(info->image, imageHandle); CORRADE_COMPARE(info->viewType, VK_IMAGE_VIEW_TYPE_2D); - CORRADE_COMPARE(info->format, data.format); - CORRADE_COMPARE(info->subresourceRange.aspectMask, data.aspect); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); + CORRADE_COMPARE(info->subresourceRange.aspectMask, VK_IMAGE_ASPECT_COLOR_BIT); CORRADE_COMPARE(info->subresourceRange.baseArrayLayer, 3); CORRADE_COMPARE(info->subresourceRange.layerCount, 1); CORRADE_COMPARE(info->subresourceRange.baseMipLevel, 7); CORRADE_COMPARE(info->subresourceRange.levelCount, 9); } +void ImageViewTest::createInfoConstruct2DAspect() { + auto&& data = View2DFormatData[testCaseInstanceId()]; + setTestCaseDescription(data.name); + + ImageViewCreateInfo2D info{imageHandle, data.format}; + CORRADE_COMPARE(info->format, VkFormat(data.format)); + CORRADE_COMPARE(info->subresourceRange.aspectMask, data.aspect); +} + void ImageViewTest::createInfoConstruct2DFromImage() { Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_R8G8B8A8_SRGB); + Image image = Image::wrap(device, imageHandle, PixelFormat::RGBA8Srgb); /** @todo use a real flag once it exists */ ImageViewCreateInfo2D info{image, 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; @@ -213,13 +243,15 @@ void ImageViewTest::createInfoConstruct2DFromImage() { CORRADE_COMPARE(info->subresourceRange.levelCount, 9); } -void ImageViewTest::createInfoConstruct3D() { +template void ImageViewTest::createInfoConstruct3D() { + setTestCaseTemplateName(PixelFormatTraits::name()); + /** @todo use a real flag once it exists */ - ImageViewCreateInfo3D info{imageHandle, VK_FORMAT_R8G8B8A8_SRGB, 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; + ImageViewCreateInfo3D info{imageHandle, PixelFormatTraits::format(), 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; CORRADE_COMPARE(info->flags, VK_NOT_READY); CORRADE_COMPARE(info->image, imageHandle); CORRADE_COMPARE(info->viewType, VK_IMAGE_VIEW_TYPE_3D); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_SRGB); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(info->subresourceRange.aspectMask, VK_IMAGE_ASPECT_COLOR_BIT); CORRADE_COMPARE(info->subresourceRange.baseArrayLayer, 3); CORRADE_COMPARE(info->subresourceRange.layerCount, 1); @@ -229,7 +261,7 @@ void ImageViewTest::createInfoConstruct3D() { void ImageViewTest::createInfoConstruct3DFromImage() { Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_R8G8B8A8_SRGB); + Image image = Image::wrap(device, imageHandle, PixelFormat::RGBA8Srgb); /** @todo use a real flag once it exists */ ImageViewCreateInfo3D info{image, 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; @@ -244,13 +276,15 @@ void ImageViewTest::createInfoConstruct3DFromImage() { CORRADE_COMPARE(info->subresourceRange.levelCount, 9); } -void ImageViewTest::createInfoConstruct1DArray() { +template void ImageViewTest::createInfoConstruct1DArray() { + setTestCaseTemplateName(PixelFormatTraits::name()); + /** @todo use a real flag once it exists */ - ImageViewCreateInfo1DArray info{imageHandle, VK_FORMAT_R8G8B8A8_SRGB, 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; + ImageViewCreateInfo1DArray info{imageHandle, PixelFormatTraits::format(), 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; CORRADE_COMPARE(info->flags, VK_NOT_READY); CORRADE_COMPARE(info->image, imageHandle); CORRADE_COMPARE(info->viewType, VK_IMAGE_VIEW_TYPE_1D_ARRAY); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_SRGB); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(info->subresourceRange.aspectMask, VK_IMAGE_ASPECT_COLOR_BIT); CORRADE_COMPARE(info->subresourceRange.baseArrayLayer, 3); CORRADE_COMPARE(info->subresourceRange.layerCount, 5); @@ -260,7 +294,7 @@ void ImageViewTest::createInfoConstruct1DArray() { void ImageViewTest::createInfoConstruct1DArrayFromImage() { Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_R8G8B8A8_SRGB); + Image image = Image::wrap(device, imageHandle, PixelFormat::RGBA8Srgb); /** @todo use a real flag once it exists */ ImageViewCreateInfo1DArray info{image, 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; @@ -275,13 +309,15 @@ void ImageViewTest::createInfoConstruct1DArrayFromImage() { CORRADE_COMPARE(info->subresourceRange.levelCount, 9); } -void ImageViewTest::createInfoConstruct2DArray() { +template void ImageViewTest::createInfoConstruct2DArray() { + setTestCaseTemplateName(PixelFormatTraits::name()); + /** @todo use a real flag once it exists */ - ImageViewCreateInfo2DArray info{imageHandle, VK_FORMAT_R8G8B8A8_SRGB, 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; + ImageViewCreateInfo2DArray info{imageHandle, PixelFormatTraits::format(), 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; CORRADE_COMPARE(info->flags, VK_NOT_READY); CORRADE_COMPARE(info->image, imageHandle); CORRADE_COMPARE(info->viewType, VK_IMAGE_VIEW_TYPE_2D_ARRAY); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_SRGB); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(info->subresourceRange.aspectMask, VK_IMAGE_ASPECT_COLOR_BIT); CORRADE_COMPARE(info->subresourceRange.baseArrayLayer, 3); CORRADE_COMPARE(info->subresourceRange.layerCount, 5); @@ -291,7 +327,7 @@ void ImageViewTest::createInfoConstruct2DArray() { void ImageViewTest::createInfoConstruct2DArrayFromImage() { Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_R8G8B8A8_SRGB); + Image image = Image::wrap(device, imageHandle, PixelFormat::RGBA8Srgb); /** @todo use a real flag once it exists */ ImageViewCreateInfo2DArray info{image, 3, 5, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; @@ -306,13 +342,15 @@ void ImageViewTest::createInfoConstruct2DArrayFromImage() { CORRADE_COMPARE(info->subresourceRange.levelCount, 9); } -void ImageViewTest::createInfoConstructCubeMap() { +template void ImageViewTest::createInfoConstructCubeMap() { + setTestCaseTemplateName(PixelFormatTraits::name()); + /** @todo use a real flag once it exists */ - ImageViewCreateInfoCubeMap info{imageHandle, VK_FORMAT_R8G8B8A8_SRGB, 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; + ImageViewCreateInfoCubeMap info{imageHandle, PixelFormatTraits::format(), 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; CORRADE_COMPARE(info->flags, VK_NOT_READY); CORRADE_COMPARE(info->image, imageHandle); CORRADE_COMPARE(info->viewType, VK_IMAGE_VIEW_TYPE_CUBE); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_SRGB); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(info->subresourceRange.aspectMask, VK_IMAGE_ASPECT_COLOR_BIT); CORRADE_COMPARE(info->subresourceRange.baseArrayLayer, 3); CORRADE_COMPARE(info->subresourceRange.layerCount, 6); @@ -322,7 +360,7 @@ void ImageViewTest::createInfoConstructCubeMap() { void ImageViewTest::createInfoConstructCubeMapFromImage() { Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_R8G8B8A8_SRGB); + Image image = Image::wrap(device, imageHandle, PixelFormat::RGBA8Srgb); /** @todo use a real flag once it exists */ ImageViewCreateInfoCubeMap info{image, 3, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; @@ -337,13 +375,15 @@ void ImageViewTest::createInfoConstructCubeMapFromImage() { CORRADE_COMPARE(info->subresourceRange.levelCount, 9); } -void ImageViewTest::createInfoConstructCubeMapArray() { +template void ImageViewTest::createInfoConstructCubeMapArray() { + setTestCaseTemplateName(PixelFormatTraits::name()); + /** @todo use a real flag once it exists */ - ImageViewCreateInfoCubeMapArray info{imageHandle, VK_FORMAT_R8G8B8A8_SRGB, 3, 18, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; + ImageViewCreateInfoCubeMapArray info{imageHandle, PixelFormatTraits::format(), 3, 18, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; CORRADE_COMPARE(info->flags, VK_NOT_READY); CORRADE_COMPARE(info->image, imageHandle); CORRADE_COMPARE(info->viewType, VK_IMAGE_VIEW_TYPE_CUBE_ARRAY); - CORRADE_COMPARE(info->format, VK_FORMAT_R8G8B8A8_SRGB); + CORRADE_COMPARE(info->format, PixelFormatTraits::expected()); CORRADE_COMPARE(info->subresourceRange.aspectMask, VK_IMAGE_ASPECT_COLOR_BIT); CORRADE_COMPARE(info->subresourceRange.baseArrayLayer, 3); CORRADE_COMPARE(info->subresourceRange.layerCount, 18); @@ -353,7 +393,7 @@ void ImageViewTest::createInfoConstructCubeMapArray() { void ImageViewTest::createInfoConstructCubeMapArrayFromImage() { Device device{NoCreate}; - Image image = Image::wrap(device, imageHandle, VK_FORMAT_R8G8B8A8_SRGB); + Image image = Image::wrap(device, imageHandle, PixelFormat::RGBA8Srgb); /** @todo use a real flag once it exists */ ImageViewCreateInfoCubeMapArray info{image, 3, 18, 7, 9, ImageViewCreateInfo::Flag(VK_NOT_READY)}; diff --git a/src/Magnum/Vk/Test/ImageViewVkTest.cpp b/src/Magnum/Vk/Test/ImageViewVkTest.cpp index 538995d41..77b059e75 100644 --- a/src/Magnum/Vk/Test/ImageViewVkTest.cpp +++ b/src/Magnum/Vk/Test/ImageViewVkTest.cpp @@ -29,6 +29,7 @@ #include "Magnum/Vk/Handle.h" #include "Magnum/Vk/ImageCreateInfo.h" #include "Magnum/Vk/ImageViewCreateInfo.h" +#include "Magnum/Vk/PixelFormat.h" #include "Magnum/Vk/Result.h" #include "Magnum/Vk/VulkanTester.h" @@ -64,7 +65,7 @@ ImageViewVkTest::ImageViewVkTest() { void ImageViewVkTest::construct1D() { Image image{device(), ImageCreateInfo1D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, 256, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, 256, 1}, MemoryFlag::DeviceLocal}; { ImageView view{device(), ImageViewCreateInfo1D{image}}; @@ -78,7 +79,7 @@ void ImageViewVkTest::construct1D() { void ImageViewVkTest::construct2D() { Image image{device(), ImageCreateInfo2D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; { ImageView view{device(), ImageViewCreateInfo2D{image}}; @@ -92,7 +93,7 @@ void ImageViewVkTest::construct2D() { void ImageViewVkTest::construct3D() { Image image{device(), ImageCreateInfo3D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256, 10}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256, 10}, 1}, MemoryFlag::DeviceLocal}; { ImageView view{device(), ImageViewCreateInfo3D{image}}; @@ -106,7 +107,7 @@ void ImageViewVkTest::construct3D() { void ImageViewVkTest::construct1DArray() { Image image{device(), ImageCreateInfo1DArray{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 10}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 10}, 1}, MemoryFlag::DeviceLocal}; { ImageView view{device(), ImageViewCreateInfo1DArray{image}}; @@ -120,7 +121,7 @@ void ImageViewVkTest::construct1DArray() { void ImageViewVkTest::construct2DArray() { Image image{device(), ImageCreateInfo2DArray{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256, 10}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256, 10}, 1}, MemoryFlag::DeviceLocal}; { ImageView view{device(), ImageViewCreateInfo2DArray{image}}; @@ -134,7 +135,7 @@ void ImageViewVkTest::construct2DArray() { void ImageViewVkTest::constructCubeMap() { Image image{device(), ImageCreateInfoCubeMap{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; { ImageView view{device(), ImageViewCreateInfoCubeMap{image}}; @@ -156,7 +157,7 @@ void ImageViewVkTest::constructCubeMapArray() { .addQueues(0, {0.0f}, {queue2}) .setEnabledFeatures(DeviceFeature::ImageCubeArray)}; Image image{device2, ImageCreateInfoCubeMapArray{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256, 18}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256, 18}, 1}, MemoryFlag::DeviceLocal}; { ImageView view{device2, ImageViewCreateInfoCubeMapArray{image}}; @@ -170,7 +171,7 @@ void ImageViewVkTest::constructCubeMapArray() { void ImageViewVkTest::constructMove() { Image image{device(), ImageCreateInfo2D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; ImageView a{device(), ImageViewCreateInfo2D{image}}; VkImageView handle = a.handle(); @@ -192,7 +193,7 @@ void ImageViewVkTest::constructMove() { void ImageViewVkTest::wrap() { Image image{device(), ImageCreateInfo2D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; VkImageView view{}; CORRADE_COMPARE(Result(device()->CreateImageView(device(), diff --git a/src/Magnum/Vk/Test/ImageVkTest.cpp b/src/Magnum/Vk/Test/ImageVkTest.cpp index 400b37a51..2bb01218f 100644 --- a/src/Magnum/Vk/Test/ImageVkTest.cpp +++ b/src/Magnum/Vk/Test/ImageVkTest.cpp @@ -33,6 +33,8 @@ #include "Magnum/Vk/Result.h" #include "Magnum/Vk/VulkanTester.h" +#include "Magnum/Vk/Test/pixelFormatTraits.h" + namespace Magnum { namespace Vk { namespace Test { namespace { struct ImageVkTest: VulkanTester { @@ -47,7 +49,7 @@ struct ImageVkTest: VulkanTester { void constructCubeMapArray(); void constructMove(); - void wrap(); + template void wrap(); void memoryRequirements(); @@ -67,7 +69,9 @@ ImageVkTest::ImageVkTest() { &ImageVkTest::constructCubeMapArray, &ImageVkTest::constructMove, - &ImageVkTest::wrap, + &ImageVkTest::wrap, + &ImageVkTest::wrap, + &ImageVkTest::wrap, &ImageVkTest::memoryRequirements, @@ -80,10 +84,10 @@ ImageVkTest::ImageVkTest() { void ImageVkTest::construct1D() { { Image image{device(), ImageCreateInfo1D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, 256, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, 256, 8}, NoAllocate}; CORRADE_VERIFY(image.handle()); CORRADE_COMPARE(image.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(image.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(image.format(), PixelFormat::RGBA8Unorm); } /* Shouldn't crash or anything */ @@ -93,10 +97,10 @@ void ImageVkTest::construct1D() { void ImageVkTest::construct2D() { { Image image{device(), ImageCreateInfo2D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, {256, 256}, 8}, NoAllocate}; CORRADE_VERIFY(image.handle()); CORRADE_COMPARE(image.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(image.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(image.format(), PixelFormat::RGBA8Unorm); } /* Shouldn't crash or anything */ @@ -106,10 +110,10 @@ void ImageVkTest::construct2D() { void ImageVkTest::construct3D() { { Image image{device(), ImageCreateInfo3D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256, 64}, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, {256, 256, 64}, 8}, NoAllocate}; CORRADE_VERIFY(image.handle()); CORRADE_COMPARE(image.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(image.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(image.format(), PixelFormat::RGBA8Unorm); } /* Shouldn't crash or anything */ @@ -119,10 +123,10 @@ void ImageVkTest::construct3D() { void ImageVkTest::construct1DArray() { { Image image{device(), ImageCreateInfo1DArray{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 64}, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, {256, 64}, 8}, NoAllocate}; CORRADE_VERIFY(image.handle()); CORRADE_COMPARE(image.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(image.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(image.format(), PixelFormat::RGBA8Unorm); } /* Shouldn't crash or anything */ @@ -132,10 +136,10 @@ void ImageVkTest::construct1DArray() { void ImageVkTest::construct2DArray() { { Image image{device(), ImageCreateInfo2DArray{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256, 64}, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, {256, 256, 64}, 8}, NoAllocate}; CORRADE_VERIFY(image.handle()); CORRADE_COMPARE(image.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(image.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(image.format(), PixelFormat::RGBA8Unorm); } /* Shouldn't crash or anything */ @@ -145,10 +149,10 @@ void ImageVkTest::construct2DArray() { void ImageVkTest::constructCubeMap() { { Image image{device(), ImageCreateInfoCubeMap{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, {256, 256}, 8}, NoAllocate}; CORRADE_VERIFY(image.handle()); CORRADE_COMPARE(image.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(image.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(image.format(), PixelFormat::RGBA8Unorm); } /* Shouldn't crash or anything */ @@ -158,10 +162,10 @@ void ImageVkTest::constructCubeMap() { void ImageVkTest::constructCubeMapArray() { { Image image{device(), ImageCreateInfoCubeMapArray{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256, 36}, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, {256, 256, 36}, 8}, NoAllocate}; CORRADE_VERIFY(image.handle()); CORRADE_COMPARE(image.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(image.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(image.format(), PixelFormat::RGBA8Unorm); } /* Shouldn't crash or anything */ @@ -171,7 +175,7 @@ void ImageVkTest::constructCubeMapArray() { void ImageVkTest::constructMove() { /* Verify that also the dedicated memory gets moved */ Image a{device(), ImageCreateInfo2D{ImageUsage::ColorAttachment, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; VkImage handle = a.handle(); VkDeviceMemory memoryHandle = a.dedicatedMemory().handle(); @@ -181,7 +185,7 @@ void ImageVkTest::constructMove() { CORRADE_VERIFY(!a.hasDedicatedMemory()); CORRADE_COMPARE(b.handle(), handle); CORRADE_COMPARE(b.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(b.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(b.format(), PixelFormat::RGBA8Unorm); CORRADE_VERIFY(b.hasDedicatedMemory()); CORRADE_COMPARE(b.dedicatedMemory().handle(), memoryHandle); @@ -192,7 +196,7 @@ void ImageVkTest::constructMove() { CORRADE_COMPARE(b.handleFlags(), HandleFlags{}); CORRADE_COMPARE(c.handle(), handle); CORRADE_COMPARE(c.handleFlags(), HandleFlag::DestroyOnDestruction); - CORRADE_COMPARE(c.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(c.format(), PixelFormat::RGBA8Unorm); CORRADE_VERIFY(c.hasDedicatedMemory()); CORRADE_COMPARE(c.dedicatedMemory().handle(), memoryHandle); @@ -200,17 +204,19 @@ void ImageVkTest::constructMove() { CORRADE_VERIFY(std::is_nothrow_move_assignable::value); } -void ImageVkTest::wrap() { +template void ImageVkTest::wrap() { + setTestCaseTemplateName(PixelFormatTraits::name()); + VkImage image{}; CORRADE_COMPARE(Result(device()->CreateImage(device(), ImageCreateInfo2D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 8}, + PixelFormatTraits::format(), {256, 256}, 8}, nullptr, &image)), Result::Success); CORRADE_VERIFY(image); - auto wrapped = Image::wrap(device(), image, VK_FORMAT_R8G8B8A8_UNORM, HandleFlag::DestroyOnDestruction); + auto wrapped = Image::wrap(device(), image, PixelFormatTraits::format(), HandleFlag::DestroyOnDestruction); CORRADE_COMPARE(wrapped.handle(), image); - CORRADE_COMPARE(wrapped.format(), VK_FORMAT_R8G8B8A8_UNORM); + CORRADE_COMPARE(wrapped.format(), PixelFormat(PixelFormatTraits::expected())); /* Release the handle again, destroy by hand */ CORRADE_COMPARE(wrapped.release(), image); @@ -220,7 +226,7 @@ void ImageVkTest::wrap() { void ImageVkTest::memoryRequirements() { /* Use linear tiling for a deterministic memory size */ - ImageCreateInfo2D info{ImageUsage::Sampled, VK_FORMAT_R8G8B8A8_UNORM, {128, 64}, 1}; + ImageCreateInfo2D info{ImageUsage::Sampled, PixelFormat::RGBA8Unorm, {128, 64}, 1}; info->tiling = VK_IMAGE_TILING_LINEAR; Image image{device(), info, NoAllocate}; @@ -238,7 +244,7 @@ void ImageVkTest::memoryRequirements() { void ImageVkTest::bindMemory() { Image image{device(), ImageCreateInfo2D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, {256, 256}, 8}, NoAllocate}; MemoryRequirements requirements = image.memoryRequirements(); /* We're testing the offset, so ensure what we hardcode is correctly @@ -258,7 +264,7 @@ void ImageVkTest::bindMemory() { void ImageVkTest::bindDedicatedMemory() { Image image{device(), ImageCreateInfo2D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 8}, NoAllocate}; + PixelFormat::RGBA8Unorm, {256, 256}, 8}, NoAllocate}; MemoryRequirements requirements = image.memoryRequirements(); /** @todo expand once KHR_dedicated_allocation is implemented */ @@ -276,7 +282,7 @@ void ImageVkTest::bindDedicatedMemory() { void ImageVkTest::directAllocation() { Image image{device(), ImageCreateInfo2D{ImageUsage::Sampled, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 8}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 8}, MemoryFlag::DeviceLocal}; /* Not sure what else to test here */ CORRADE_VERIFY(image.hasDedicatedMemory()); diff --git a/src/Magnum/Vk/Test/PixelFormatTest.cpp b/src/Magnum/Vk/Test/PixelFormatTest.cpp new file mode 100644 index 000000000..0ee3ef39b --- /dev/null +++ b/src/Magnum/Vk/Test/PixelFormatTest.cpp @@ -0,0 +1,274 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, + 2020 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. +*/ + +#include +#include +#include + +#include "Magnum/PixelFormat.h" +#include "Magnum/Vk/PixelFormat.h" + +namespace Magnum { namespace Vk { namespace Test { namespace { + +struct PixelFormatTest: TestSuite::Tester { + explicit PixelFormatTest(); + + void mapPixelFormat(); + void mapPixelFormatImplementationSpecific(); + void mapPixelFormatUnsupported(); + void mapPixelFormatInvalid(); + + void mapCompressedPixelFormat(); + void mapCompressedPixelFormatImplementationSpecific(); + void mapCompressedPixelFormatUnsupported(); + void mapCompressedPixelFormatInvalid(); + + void debug(); +}; + +PixelFormatTest::PixelFormatTest() { + addTests({&PixelFormatTest::mapPixelFormat, + &PixelFormatTest::mapPixelFormatImplementationSpecific, + &PixelFormatTest::mapPixelFormatUnsupported, + &PixelFormatTest::mapPixelFormatInvalid, + + &PixelFormatTest::mapCompressedPixelFormat, + &PixelFormatTest::mapCompressedPixelFormatImplementationSpecific, + &PixelFormatTest::mapCompressedPixelFormatUnsupported, + &PixelFormatTest::mapCompressedPixelFormatInvalid, + + &PixelFormatTest::debug}); +} + +void PixelFormatTest::mapPixelFormat() { + /* Touchstone verification. Using Vulkan enums directly to sidestep + potential problems in enum mapping as well. */ + CORRADE_VERIFY(hasPixelFormat(Magnum::PixelFormat::RGBA8Unorm)); + CORRADE_COMPARE(pixelFormat(Magnum::PixelFormat::RGBA8Unorm), PixelFormat(VK_FORMAT_R8G8B8A8_UNORM)); + + /* This goes through the first 16 bits, which should be enough. Going + through 32 bits takes 8 seconds, too much. */ + UnsignedInt firstUnhandled = 0xffff; + UnsignedInt nextHandled = 1; /* 0 is an invalid format */ + for(UnsignedInt i = 1; i <= 0xffff; ++i) { + const auto format = Magnum::PixelFormat(i); + /* Each case verifies: + - that the entries are ordered by number by comparing a function to + expected result (so insertion here is done in proper place) + - that there was no gap (unhandled value inside the range) + - that a particular pixel format maps to a particular vkFormat */ + #ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic error "-Wswitch" + #endif + switch(format) { + #define _c(format) \ + case Magnum::PixelFormat::format: \ + CORRADE_COMPARE(nextHandled, i); \ + CORRADE_COMPARE(firstUnhandled, 0xffff); \ + CORRADE_VERIFY(hasPixelFormat(Magnum::PixelFormat::format)); \ + CORRADE_COMPARE(pixelFormat(Magnum::PixelFormat::format), PixelFormat::format); \ + ++nextHandled; \ + continue; + #define _s(format) \ + case Magnum::PixelFormat::format: { \ + CORRADE_COMPARE(nextHandled, i); \ + CORRADE_COMPARE(firstUnhandled, 0xffff); \ + CORRADE_VERIFY(!hasPixelFormat(Magnum::PixelFormat::format)); \ + std::ostringstream out; \ + { /* Redirected otherwise graceful assert would abort */ \ + Error redirectError{&out}; \ + pixelFormat(Magnum::PixelFormat::format); \ + } \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + ++nextHandled; \ + continue; \ + } + #include "Magnum/Vk/Implementation/pixelFormatMapping.hpp" + #undef _s + #undef _c + } + #ifdef __GNUC__ + #pragma GCC diagnostic pop + #endif + + /* Not handled by any value, remember -- we might either be at the end + of the enum range (which is okay) or some value might be unhandled + here */ + firstUnhandled = i; + } + + CORRADE_COMPARE(firstUnhandled, 0xffff); +} + +void PixelFormatTest::mapPixelFormatImplementationSpecific() { + CORRADE_VERIFY(hasPixelFormat(Magnum::pixelFormatWrap(VK_FORMAT_A8B8G8R8_SINT_PACK32))); + CORRADE_COMPARE(pixelFormat(Magnum::pixelFormatWrap(VK_FORMAT_A8B8G8R8_SINT_PACK32)), + PixelFormat(VK_FORMAT_A8B8G8R8_SINT_PACK32)); +} + +void PixelFormatTest::mapPixelFormatUnsupported() { + #ifdef CORRADE_NO_ASSERT + CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); + #endif + + #if 1 + CORRADE_SKIP("All pixel formats are supported."); + #else + std::ostringstream out; + Error redirectError{&out}; + + pixelFormat(Magnum::PixelFormat::RGB16UI); + CORRADE_COMPARE(out.str(), "Vk::pixelFormat(): unsupported format PixelFormat::RGB16UI\n"); + #endif +} + +void PixelFormatTest::mapPixelFormatInvalid() { + #ifdef CORRADE_NO_ASSERT + CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); + #endif + + std::ostringstream out; + Error redirectError{&out}; + + hasPixelFormat(Magnum::PixelFormat{}); + hasPixelFormat(Magnum::PixelFormat(0x123)); + pixelFormat(Magnum::PixelFormat{}); + pixelFormat(Magnum::PixelFormat(0x123)); + CORRADE_COMPARE(out.str(), + "Vk::hasPixelFormat(): invalid format PixelFormat(0x0)\n" + "Vk::hasPixelFormat(): invalid format PixelFormat(0x123)\n" + "Vk::pixelFormat(): invalid format PixelFormat(0x0)\n" + "Vk::pixelFormat(): invalid format PixelFormat(0x123)\n"); +} + +void PixelFormatTest::mapCompressedPixelFormat() { + /* Touchstone verification. Using Vulkan enums directly to sidestep + potential problems in enum mapping as well. */ + CORRADE_VERIFY(hasPixelFormat(Magnum::CompressedPixelFormat::Bc1RGBAUnorm)); + CORRADE_COMPARE(pixelFormat(Magnum::CompressedPixelFormat::Bc1RGBAUnorm), PixelFormat(VK_FORMAT_BC1_RGBA_UNORM_BLOCK)); + + /* This goes through the first 16 bits, which should be enough. Going + through 32 bits takes 8 seconds, too much. */ + UnsignedInt firstUnhandled = 0xffff; + UnsignedInt nextHandled = 1; /* 0 is an invalid format */ + for(UnsignedInt i = 1; i <= 0xffff; ++i) { + const auto format = Magnum::CompressedPixelFormat(i); + /* Each case verifies: + - that the entries are ordered by number by comparing a function to + expected result (so insertion here is done in proper place) + - that there was no gap (unhandled value inside the range) + - that a particular pixel format maps to a particular VkFormat */ + #ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic error "-Wswitch" + #endif + switch(format) { + #define _c(format, expectedFormat) \ + case Magnum::CompressedPixelFormat::format: \ + CORRADE_COMPARE(nextHandled, i); \ + CORRADE_COMPARE(firstUnhandled, 0xffff); \ + CORRADE_VERIFY(hasPixelFormat(Magnum::CompressedPixelFormat::format)); \ + CORRADE_COMPARE(pixelFormat(Magnum::CompressedPixelFormat::format), PixelFormat::Compressed ## expectedFormat); \ + ++nextHandled; \ + continue; + #define _s(format) \ + case Magnum::CompressedPixelFormat::format: { \ + CORRADE_COMPARE(nextHandled, i); \ + CORRADE_COMPARE(firstUnhandled, 0xffff); \ + CORRADE_VERIFY(!hasPixelFormat(Magnum::CompressedPixelFormat::format)); \ + std::ostringstream out; \ + { /* Redirected otherwise graceful assert would abort */ \ + Error redirectError{&out}; \ + pixelFormat(Magnum::CompressedPixelFormat::format); \ + } \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + ++nextHandled; \ + continue; \ + } + #include "Magnum/Vk/Implementation/compressedPixelFormatMapping.hpp" + #undef _s + #undef _c + } + #ifdef __GNUC__ + #pragma GCC diagnostic pop + #endif + + /* Not handled by any value, remember -- we might either be at the end + of the enum range (which is okay) or some value might be unhandled + here */ + firstUnhandled = i; + } + + CORRADE_COMPARE(firstUnhandled, 0xffff); +} + +void PixelFormatTest::mapCompressedPixelFormatImplementationSpecific() { + CORRADE_VERIFY(hasPixelFormat(Magnum::compressedPixelFormatWrap(VK_FORMAT_ASTC_10x6_UNORM_BLOCK))); + CORRADE_COMPARE(pixelFormat(Magnum::compressedPixelFormatWrap(VK_FORMAT_ASTC_10x6_UNORM_BLOCK)), + PixelFormat(VK_FORMAT_ASTC_10x6_UNORM_BLOCK)); +} + +void PixelFormatTest::mapCompressedPixelFormatUnsupported() { + #ifdef CORRADE_NO_ASSERT + CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); + #endif + + CORRADE_VERIFY(!hasPixelFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm)); + + std::ostringstream out; + Error redirectError{&out}; + pixelFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm); + CORRADE_COMPARE(out.str(), "Vk::pixelFormat(): unsupported format CompressedPixelFormat::Astc3x3x3RGBAUnorm\n"); +} + +void PixelFormatTest::mapCompressedPixelFormatInvalid() { + #ifdef CORRADE_NO_ASSERT + CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); + #endif + + std::ostringstream out; + Error redirectError{&out}; + + hasPixelFormat(Magnum::CompressedPixelFormat{}); + hasPixelFormat(Magnum::CompressedPixelFormat(0x123)); + pixelFormat(Magnum::CompressedPixelFormat{}); + pixelFormat(Magnum::CompressedPixelFormat(0x123)); + CORRADE_COMPARE(out.str(), + "Vk::hasPixelFormat(): invalid format CompressedPixelFormat(0x0)\n" + "Vk::hasPixelFormat(): invalid format CompressedPixelFormat(0x123)\n" + "Vk::pixelFormat(): invalid format CompressedPixelFormat(0x0)\n" + "Vk::pixelFormat(): invalid format CompressedPixelFormat(0x123)\n"); +} + +void PixelFormatTest::debug() { + std::ostringstream out; + Debug{&out} << PixelFormat::RGB16UI << PixelFormat(-10007655); + CORRADE_COMPARE(out.str(), "Vk::PixelFormat::RGB16UI Vk::PixelFormat(-10007655)\n"); +} + +}}}} + +CORRADE_TEST_MAIN(Magnum::Vk::Test::PixelFormatTest) diff --git a/src/Magnum/Vk/Test/RenderPassTest.cpp b/src/Magnum/Vk/Test/RenderPassTest.cpp index 39f2c848e..62b756548 100644 --- a/src/Magnum/Vk/Test/RenderPassTest.cpp +++ b/src/Magnum/Vk/Test/RenderPassTest.cpp @@ -38,6 +38,8 @@ #include "Magnum/Vk/Integration.h" #include "Magnum/Vk/RenderPassCreateInfo.h" +#include "Magnum/Vk/Test/pixelFormatTraits.h" + namespace Magnum { namespace Vk { namespace Test { namespace { struct RenderPassTest: TestSuite::Tester { @@ -49,11 +51,11 @@ struct RenderPassTest: TestSuite::Tester { the contained structure are correctly propagated to the resulting structures. */ - void attachmentDescriptionConstruct(); - void attachmentDescriptionConstructImplicitLayout(); - void attachmentDescriptionConstructDepthStencil(); - void attachmentDescriptionConstructDepthStencilImplicitLayout(); - void attachmentDescriptionConstructImplicitLoadStoreLayout(); + template void attachmentDescriptionConstruct(); + template void attachmentDescriptionConstructImplicitLayout(); + template void attachmentDescriptionConstructDepthStencil(); + template void attachmentDescriptionConstructDepthStencilImplicitLayout(); + template void attachmentDescriptionConstructImplicitLoadStoreLayout(); void attachmentDescriptionConstructNoInit(); template void attachmentDescriptionConstructFromVk(); template void attachmentDescriptionConvertToVk(); @@ -117,11 +119,21 @@ struct RenderPassTest: TestSuite::Tester { }; RenderPassTest::RenderPassTest() { - addTests({&RenderPassTest::attachmentDescriptionConstruct, - &RenderPassTest::attachmentDescriptionConstructImplicitLayout, - &RenderPassTest::attachmentDescriptionConstructDepthStencil, - &RenderPassTest::attachmentDescriptionConstructDepthStencilImplicitLayout, - &RenderPassTest::attachmentDescriptionConstructImplicitLoadStoreLayout, + addTests({&RenderPassTest::attachmentDescriptionConstruct, + &RenderPassTest::attachmentDescriptionConstruct, + &RenderPassTest::attachmentDescriptionConstruct, + &RenderPassTest::attachmentDescriptionConstructImplicitLayout, + &RenderPassTest::attachmentDescriptionConstructImplicitLayout, + &RenderPassTest::attachmentDescriptionConstructImplicitLayout, + &RenderPassTest::attachmentDescriptionConstructDepthStencil, + &RenderPassTest::attachmentDescriptionConstructDepthStencil, + &RenderPassTest::attachmentDescriptionConstructDepthStencil, + &RenderPassTest::attachmentDescriptionConstructDepthStencilImplicitLayout, + &RenderPassTest::attachmentDescriptionConstructDepthStencilImplicitLayout, + &RenderPassTest::attachmentDescriptionConstructDepthStencilImplicitLayout, + &RenderPassTest::attachmentDescriptionConstructImplicitLoadStoreLayout, + &RenderPassTest::attachmentDescriptionConstructImplicitLoadStoreLayout, + &RenderPassTest::attachmentDescriptionConstructImplicitLoadStoreLayout, &RenderPassTest::attachmentDescriptionConstructNoInit, &RenderPassTest::attachmentDescriptionConstructFromVk, &RenderPassTest::attachmentDescriptionConstructFromVk, @@ -242,13 +254,15 @@ _ca(RenderPassCreateInfo) #undef _c #undef _ca -void RenderPassTest::attachmentDescriptionConstruct() { - AttachmentDescription description{VK_FORMAT_R8G8B8A8_SNORM, +template void RenderPassTest::attachmentDescriptionConstruct() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + AttachmentDescription description{PixelFormatTraits::format(), AttachmentLoadOperation::Clear, AttachmentStoreOperation::DontCare, ImageLayout::ColorAttachment, ImageLayout::TransferDestination, 4, AttachmentDescription::Flag::MayAlias}; CORRADE_COMPARE(description->flags, VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT); - CORRADE_COMPARE(description->format, VK_FORMAT_R8G8B8A8_SNORM); + CORRADE_COMPARE(description->format, PixelFormatTraits::expected()); CORRADE_COMPARE(description->samples, VK_SAMPLE_COUNT_4_BIT); CORRADE_COMPARE(description->loadOp, VK_ATTACHMENT_LOAD_OP_CLEAR); CORRADE_COMPARE(description->stencilLoadOp, VK_ATTACHMENT_LOAD_OP_LOAD); @@ -258,12 +272,14 @@ void RenderPassTest::attachmentDescriptionConstruct() { CORRADE_COMPARE(description->finalLayout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); } -void RenderPassTest::attachmentDescriptionConstructImplicitLayout() { - AttachmentDescription description{VK_FORMAT_R8G8B8A8_SNORM, +template void RenderPassTest::attachmentDescriptionConstructImplicitLayout() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + AttachmentDescription description{PixelFormatTraits::format(), AttachmentLoadOperation::Clear, AttachmentStoreOperation::DontCare, 4, AttachmentDescription::Flag::MayAlias}; CORRADE_COMPARE(description->flags, VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT); - CORRADE_COMPARE(description->format, VK_FORMAT_R8G8B8A8_SNORM); + CORRADE_COMPARE(description->format, PixelFormatTraits::expected()); CORRADE_COMPARE(description->samples, VK_SAMPLE_COUNT_4_BIT); CORRADE_COMPARE(description->loadOp, VK_ATTACHMENT_LOAD_OP_CLEAR); CORRADE_COMPARE(description->stencilLoadOp, VK_ATTACHMENT_LOAD_OP_LOAD); @@ -273,14 +289,16 @@ void RenderPassTest::attachmentDescriptionConstructImplicitLayout() { CORRADE_COMPARE(description->finalLayout, VK_IMAGE_LAYOUT_GENERAL); } -void RenderPassTest::attachmentDescriptionConstructDepthStencil() { - AttachmentDescription description{VK_FORMAT_R8G8B8A8_SNORM, +template void RenderPassTest::attachmentDescriptionConstructDepthStencil() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + AttachmentDescription description{PixelFormatTraits::format(), {AttachmentLoadOperation::Clear, AttachmentLoadOperation::DontCare}, {AttachmentStoreOperation::Store, AttachmentStoreOperation::DontCare}, ImageLayout::DepthStencilAttachment, ImageLayout::ShaderReadOnly, 4, AttachmentDescription::Flag::MayAlias}; CORRADE_COMPARE(description->flags, VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT); - CORRADE_COMPARE(description->format, VK_FORMAT_R8G8B8A8_SNORM); + CORRADE_COMPARE(description->format, PixelFormatTraits::expected()); CORRADE_COMPARE(description->samples, VK_SAMPLE_COUNT_4_BIT); CORRADE_COMPARE(description->loadOp, VK_ATTACHMENT_LOAD_OP_CLEAR); CORRADE_COMPARE(description->stencilLoadOp, VK_ATTACHMENT_LOAD_OP_DONT_CARE); @@ -290,13 +308,15 @@ void RenderPassTest::attachmentDescriptionConstructDepthStencil() { CORRADE_COMPARE(description->finalLayout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); } -void RenderPassTest::attachmentDescriptionConstructDepthStencilImplicitLayout() { - AttachmentDescription description{VK_FORMAT_R8G8B8A8_SNORM, +template void RenderPassTest::attachmentDescriptionConstructDepthStencilImplicitLayout() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + AttachmentDescription description{PixelFormatTraits::format(), {AttachmentLoadOperation::Clear, AttachmentLoadOperation::DontCare}, {AttachmentStoreOperation::Store, AttachmentStoreOperation::DontCare}, 4, AttachmentDescription::Flag::MayAlias}; CORRADE_COMPARE(description->flags, VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT); - CORRADE_COMPARE(description->format, VK_FORMAT_R8G8B8A8_SNORM); + CORRADE_COMPARE(description->format, PixelFormatTraits::expected()); CORRADE_COMPARE(description->samples, VK_SAMPLE_COUNT_4_BIT); CORRADE_COMPARE(description->loadOp, VK_ATTACHMENT_LOAD_OP_CLEAR); CORRADE_COMPARE(description->stencilLoadOp, VK_ATTACHMENT_LOAD_OP_DONT_CARE); @@ -306,11 +326,13 @@ void RenderPassTest::attachmentDescriptionConstructDepthStencilImplicitLayout() CORRADE_COMPARE(description->finalLayout, VK_IMAGE_LAYOUT_GENERAL); } -void RenderPassTest::attachmentDescriptionConstructImplicitLoadStoreLayout() { - AttachmentDescription description{VK_FORMAT_R8G8B8A8_SNORM, +template void RenderPassTest::attachmentDescriptionConstructImplicitLoadStoreLayout() { + setTestCaseTemplateName(PixelFormatTraits::name()); + + AttachmentDescription description{PixelFormatTraits::format(), 4, AttachmentDescription::Flag::MayAlias}; CORRADE_COMPARE(description->flags, VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT); - CORRADE_COMPARE(description->format, VK_FORMAT_R8G8B8A8_SNORM); + CORRADE_COMPARE(description->format, PixelFormatTraits::expected()); CORRADE_COMPARE(description->samples, VK_SAMPLE_COUNT_4_BIT); CORRADE_COMPARE(description->loadOp, VK_ATTACHMENT_LOAD_OP_LOAD); CORRADE_COMPARE(description->stencilLoadOp, VK_ATTACHMENT_LOAD_OP_LOAD); @@ -362,7 +384,7 @@ template void RenderPassTest::attachmentDescriptionConstru template void RenderPassTest::attachmentDescriptionConvertToVk() { setTestCaseTemplateName(Traits::name()); - AttachmentDescription description{VK_FORMAT_R8G8B8A8_SNORM, + AttachmentDescription description{PixelFormat::RGBA8Snorm, {AttachmentLoadOperation::Clear, AttachmentLoadOperation::DontCare}, {AttachmentStoreOperation::Store, AttachmentStoreOperation::DontCare}, ImageLayout::ShaderReadOnly, ImageLayout::TransferDestination, 32, AttachmentDescription::Flag::MayAlias}; @@ -796,8 +818,8 @@ void RenderPassTest::createInfoConstructNoInit() { void RenderPassTest::createInfoConstructAttachments() { RenderPassCreateInfo info; info.setAttachments({ - {VK_FORMAT_R16G16B16A16_SFLOAT, AttachmentLoadOperation::Clear, AttachmentStoreOperation::DontCare}, - {VK_FORMAT_R8G8B8_SNORM, 4} + {PixelFormat::RGBA16F, AttachmentLoadOperation::Clear, AttachmentStoreOperation::DontCare}, + {PixelFormat::RGB8Snorm, 4} }); CORRADE_COMPARE(info->attachmentCount, 2); CORRADE_VERIFY(info->pAttachments); @@ -931,7 +953,7 @@ void RenderPassTest::createInfoConstructCopy() { void RenderPassTest::createInfoConstructMove() { RenderPassCreateInfo a; - a.setAttachments({VK_FORMAT_D32_SFLOAT, VK_FORMAT_R8G8B8_SNORM}); + a.setAttachments({PixelFormat::Depth32F, PixelFormat::RGB8Snorm}); CORRADE_COMPARE(a->attachmentCount, 2); CORRADE_COMPARE(a->pAttachments[1].format, VK_FORMAT_R8G8B8_SNORM); @@ -958,8 +980,8 @@ template void RenderPassTest::createInfoConvertToVk() { RenderPassCreateInfo info; info.setAttachments({ - AttachmentDescription{VK_FORMAT_A1R5G5B5_UNORM_PACK16}, - AttachmentDescription{{}, {}, {AttachmentStoreOperation::Store, AttachmentStoreOperation::DontCare}} + AttachmentDescription{PixelFormat::RGB16UI}, + AttachmentDescription{PixelFormat{}, {}, {AttachmentStoreOperation::Store, AttachmentStoreOperation::DontCare}} }) .addSubpass(SubpassDescription{}.setColorAttachments({1, {15, ImageLayout::ShaderReadOnly}})) .addSubpass(SubpassDescription{}.setDepthStencilAttachment({15, ImageLayout::ShaderReadOnly})) @@ -970,7 +992,7 @@ template void RenderPassTest::createInfoConvertToVk() { CORRADE_COMPARE(to.attachmentCount, 2); CORRADE_VERIFY(to.pAttachments); - CORRADE_COMPARE(to.pAttachments[0].format, VK_FORMAT_A1R5G5B5_UNORM_PACK16); + CORRADE_COMPARE(to.pAttachments[0].format, VK_FORMAT_R16G16B16_UINT); CORRADE_COMPARE(to.pAttachments[1].stencilStoreOp, VK_ATTACHMENT_STORE_OP_DONT_CARE); CORRADE_COMPARE(to.subpassCount, 3); diff --git a/src/Magnum/Vk/Test/RenderPassVkTest.cpp b/src/Magnum/Vk/Test/RenderPassVkTest.cpp index 07919854e..7f351a15a 100644 --- a/src/Magnum/Vk/Test/RenderPassVkTest.cpp +++ b/src/Magnum/Vk/Test/RenderPassVkTest.cpp @@ -36,6 +36,7 @@ #include "Magnum/Vk/Handle.h" #include "Magnum/Vk/ImageCreateInfo.h" #include "Magnum/Vk/ImageViewCreateInfo.h" +#include "Magnum/Vk/PixelFormat.h" #include "Magnum/Vk/RenderPassCreateInfo.h" #include "Magnum/Vk/Result.h" #include "Magnum/Vk/VulkanTester.h" @@ -69,7 +70,7 @@ RenderPassVkTest::RenderPassVkTest() { void RenderPassVkTest::construct() { { RenderPass renderPass{device(), RenderPassCreateInfo{} - .setAttachments({VK_FORMAT_R8G8B8A8_SNORM}) + .setAttachments({PixelFormat::RGBA8Unorm}) .addSubpass(SubpassDescription{}.setColorAttachments({0})) }; CORRADE_VERIFY(renderPass.handle()); @@ -102,7 +103,7 @@ void RenderPassVkTest::constructSubpassNoAttachments() { void RenderPassVkTest::constructMove() { RenderPass a{device(), RenderPassCreateInfo{} - .setAttachments({VK_FORMAT_R8G8B8A8_SNORM}) + .setAttachments({PixelFormat::RGBA8Unorm}) .addSubpass(SubpassDescription{}.setColorAttachments({0})) }; VkRenderPass handle = a.handle(); @@ -127,7 +128,7 @@ void RenderPassVkTest::wrap() { VkRenderPass renderPass{}; CORRADE_COMPARE(Result(device()->CreateRenderPass(device(), RenderPassCreateInfo{} - .setAttachments({VK_FORMAT_R8G8B8A8_SNORM}) + .setAttachments({PixelFormat::RGBA8Unorm}) .addSubpass(SubpassDescription{}.setColorAttachments({0})) .vkRenderPassCreateInfo(), nullptr, &renderPass)), Result::Success); @@ -151,9 +152,9 @@ void RenderPassVkTest::cmdBeginEnd() { /* Using a depth attachment as well even though not strictly necessary to catch potential unexpected bugs */ Image color{device(), ImageCreateInfo2D{ImageUsage::ColorAttachment, - VK_FORMAT_R8G8B8A8_UNORM, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::RGBA8Unorm, {256, 256}, 1}, MemoryFlag::DeviceLocal}; Image depth{device(), ImageCreateInfo2D{ImageUsage::DepthStencilAttachment, - VK_FORMAT_D24_UNORM_S8_UINT, {256, 256}, 1}, MemoryFlag::DeviceLocal}; + PixelFormat::Depth24UnormStencil8UI, {256, 256}, 1}, MemoryFlag::DeviceLocal}; ImageView colorView{device(), ImageViewCreateInfo2D{color}}; ImageView depthView{device(), ImageViewCreateInfo2D{depth}}; diff --git a/src/Magnum/Vk/Test/pixelFormatTraits.h b/src/Magnum/Vk/Test/pixelFormatTraits.h new file mode 100644 index 000000000..d0b7b9e6a --- /dev/null +++ b/src/Magnum/Vk/Test/pixelFormatTraits.h @@ -0,0 +1,52 @@ +#ifndef Magnum_Vk_Test_pixelFormatTraits_h +#define Magnum_Vk_Test_pixelFormatTraits_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, + 2020 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. +*/ + +#include "Magnum/PixelFormat.h" +#include "Magnum/Vk/PixelFormat.h" + +namespace Magnum { namespace Vk { namespace Test { namespace { + +template struct PixelFormatTraits; +template<> struct PixelFormatTraits { + static const char* name() { return "PixelFormat"; } + static PixelFormat format() { return PixelFormat::RGBA8Srgb; } + static VkFormat expected() { return VK_FORMAT_R8G8B8A8_SRGB; } +}; +template<> struct PixelFormatTraits { + static const char* name() { return "Magnum::PixelFormat"; } + static Magnum::PixelFormat format() { return Magnum::PixelFormat::RGBA8Srgb; } + static VkFormat expected() { return VK_FORMAT_R8G8B8A8_SRGB; } +}; +template<> struct PixelFormatTraits { + static const char* name() { return "Magnum::CompressedPixelFormat"; } + static Magnum::CompressedPixelFormat format() { return Magnum::CompressedPixelFormat::Bc3RGBASrgb; } + static VkFormat expected() { return VK_FORMAT_BC3_SRGB_BLOCK; } +}; + +}}}} + +#endif diff --git a/src/Magnum/Vk/Vk.h b/src/Magnum/Vk/Vk.h index 10b92709e..467d30eaa 100644 --- a/src/Magnum/Vk/Vk.h +++ b/src/Magnum/Vk/Vk.h @@ -76,6 +76,7 @@ enum class MemoryFlag: UnsignedInt; typedef Containers::EnumSet MemoryFlags; enum class MemoryHeapFlag: UnsignedInt; typedef Containers::EnumSet MemoryHeapFlags; +enum class PixelFormat: Int; class Queue; enum class QueueFlag: UnsignedInt; typedef Containers::EnumSet QueueFlags;