diff --git a/doc/changelog.dox b/doc/changelog.dox index 9f009fcba..12fd83728 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -191,6 +191,8 @@ See also: @subsubsection changelog-latest-new-vk Vk library - Updated Vulkan headers for version 1.2 +- Conversion of @ref VertexFormat values to the @type_vk{Format} enum using + @ref Vk::vkFormat(Magnum::VertexFormat) @subsection changelog-latest-changes Changes and improvements diff --git a/src/Magnum/GL/Attribute.cpp b/src/Magnum/GL/Attribute.cpp index 9233df4fa..66e028d09 100644 --- a/src/Magnum/GL/Attribute.cpp +++ b/src/Magnum/GL/Attribute.cpp @@ -469,7 +469,41 @@ Debug& operator<<(Debug& debug, const Attribute>::DataTyp } +bool hasVertexFormat(const VertexFormat format) { + switch(vertexFormatComponentFormat(format)) { + case VertexFormat::UnsignedByte: + case VertexFormat::Byte: + case VertexFormat::UnsignedShort: + case VertexFormat::Short: + case VertexFormat::UnsignedInt: + case VertexFormat::Int: + case VertexFormat::Float: + return true; + + case VertexFormat::Half: + #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) + return true; + #else + return false; + #endif + + case VertexFormat::Double: + #ifndef MAGNUM_TARGET_GLES + return true; + #else + return false; + #endif + + /* Nothing else expected to be returned from + vertexFormatComponentFormat() */ + default: CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ + } +} + DynamicAttribute::DynamicAttribute(const Kind kind, UnsignedInt location, const VertexFormat format, GLint maxComponents): _kind{kind}, _location{location}, _components{Components(vertexFormatComponentCount(format))} { + CORRADE_ASSERT(hasVertexFormat(format), + "GL::DynamicAttribute:" << format << "isn't available on this target", ); + /* Translate component type to a GL-specific value */ switch(vertexFormatComponentFormat(format)) { #define _c(format) \ @@ -492,7 +526,8 @@ DynamicAttribute::DynamicAttribute(const Kind kind, UnsignedInt location, const #undef _c /* Nothing else expected to be returned from - vertexFormatComponentFormat() */ + vertexFormatComponentFormat(), the unavailable formats were caught + by the hasVertexFormat() above already */ default: CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ } diff --git a/src/Magnum/GL/Attribute.h b/src/Magnum/GL/Attribute.h index 4dd3114c0..dc1a71430 100644 --- a/src/Magnum/GL/Attribute.h +++ b/src/Magnum/GL/Attribute.h @@ -26,7 +26,7 @@ */ /** @file - * @brief Class @ref Magnum::GL::Attribute + * @brief Class @ref Magnum::GL::Attribute, @ref Magnum::GL::DynamicAttribute, function @ref Magnum::GL::hasVertexFormat() */ #include @@ -547,10 +547,11 @@ class MAGNUM_GL_EXPORT DynamicAttribute { * @brief Construct from a generic mesh attribute type * @m_since_latest * - * The @p type is expected to be compatible with @p kind --- i.e., - * normalized or floating-point for @ref Kind::GenericNormalized, - * non-normalized for @ref Kind::Integral / @ref Kind::Long and - * integral for @ref Kind::Integral. + * The @p type is expected to be available on given target and be + * compatible with @p kind --- i.e., normalized or floating-point for + * @ref Kind::GenericNormalized, non-normalized for @ref Kind::Integral + * / @ref Kind::Long and integral for @ref Kind::Integral. + * @see @ref hasVertexFormat() */ explicit DynamicAttribute(Kind kind, UnsignedInt location, VertexFormat format): DynamicAttribute{kind, location, format, 4} {} @@ -600,6 +601,29 @@ MAGNUM_GL_EXPORT Debug& operator<<(Debug& debug, DynamicAttribute::Components); /** @debugoperatorclassenum{DynamicAttribute,DynamicAttribute::DataType} */ MAGNUM_GL_EXPORT Debug& operator<<(Debug& debug, DynamicAttribute::DataType); +/** +@brief Check availability of a generic mesh attribute type +@m_since_latest + +Some OpenGL targets don't support all mesh attribute types (for example OpenGL +ES doesn't support double-precision types). Returns @cpp false @ce if current +target can't support such type, @cpp true @ce otherwise. The @p type value is +expected to be valid. + +Note that, unlike with pixel format mapping, there's no way to represent an +implementation-specific mesh attribute type using a single 32-bit value and +thus this function returns @cpp false @ce also for all formats for which +@ref isVertexFormatImplementationSpecific() is @cpp true @ce --- you need to do +such mapping by hand by creating a corresponding @ref DynamicAttribute. + +@note Support of some formats depends on presence of a particular OpenGL + extension. Such check is outside of the scope of this function and you are + expected to verify extension availability before using such type. + +@see @ref DynamicAttribute::DynamicAttribute(Kind, UnsignedInt, VertexFormat) +*/ +MAGNUM_GL_EXPORT bool hasVertexFormat(Magnum::VertexFormat format); + namespace Implementation { template constexpr DynamicAttribute::Kind kindFor(typename std::enable_if::ScalarType, Float>::value, typename GL::Attribute::DataOptions>::type options) { diff --git a/src/Magnum/GL/Test/AttributeTest.cpp b/src/Magnum/GL/Test/AttributeTest.cpp index a745c2a13..8a8800104 100644 --- a/src/Magnum/GL/Test/AttributeTest.cpp +++ b/src/Magnum/GL/Test/AttributeTest.cpp @@ -70,6 +70,9 @@ struct AttributeTest: TestSuite::Tester { void attributeFromGenericFormatUnexpectedForLongKind(); #endif void attributeFromGenericFormatTooManyComponents(); + void attributeFromGenericFormatNotAvailable(); + + void hasVertexFormat(); void debugComponents1(); void debugComponents2(); @@ -132,6 +135,9 @@ AttributeTest::AttributeTest() { &AttributeTest::attributeFromGenericFormatUnexpectedForLongKind, #endif &AttributeTest::attributeFromGenericFormatTooManyComponents, + &AttributeTest::attributeFromGenericFormatNotAvailable, + + &AttributeTest::hasVertexFormat, &AttributeTest::debugComponents1, &AttributeTest::debugComponents2, @@ -640,6 +646,49 @@ void AttributeTest::attributeFromGenericFormatTooManyComponents() { "GL::DynamicAttribute: can't use VertexFormat::Vector3 for a 2-component attribute\n"); } +void AttributeTest::attributeFromGenericFormatNotAvailable() { + #ifndef MAGNUM_TARGET_GLES + CORRADE_SKIP("All attribute formats available on desktop GL."); + #else + std::ostringstream out; + Error redirectError{&out}; + DynamicAttribute{Attribute<7, Vector2>{}, VertexFormat::Vector3d}; + CORRADE_COMPARE(out.str(), + "GL::DynamicAttribute: VertexFormat::Vector3d isn't available on this target\n"); + #endif +} + +void AttributeTest::hasVertexFormat() { + CORRADE_VERIFY(GL::hasVertexFormat(Magnum::VertexFormat::Vector2i)); + #ifdef MAGNUM_TARGET_GLES + CORRADE_VERIFY(!GL::hasVertexFormat(Magnum::VertexFormat::Vector3d)); + #endif + + /* Ensure all generic formats are handled by going though all and executing + out functions on those. This goes through the first 16 bits, which + should be enough. Going through 32 bits takes 8 seconds, too much. */ + for(UnsignedInt i = 1; i <= 0xffff; ++i) { + const auto format = Magnum::VertexFormat(i); + /* Each case only verifies that hasVertexFormat() handles the format + and doesn't fall into unreachable code */ + #ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic error "-Wswitch" + #endif + switch(format) { + #define _c(format) \ + case Magnum::VertexFormat::format: \ + GL::hasVertexFormat(Magnum::VertexFormat::format); \ + break; + #include "Magnum/Implementation/vertexFormatMapping.hpp" + #undef _c + } + #ifdef __GNUC__ + #pragma GCC diagnostic pop + #endif + } +} + void AttributeTest::debugComponents1() { typedef Attribute<3, Float> Attribute; diff --git a/src/Magnum/VertexFormat.h b/src/Magnum/VertexFormat.h index 149c7a60d..60198f2a6 100644 --- a/src/Magnum/VertexFormat.h +++ b/src/Magnum/VertexFormat.h @@ -48,81 +48,245 @@ attribute type values using @ref vertexFormatWrap() and implementation-specific types can be done using @ref isVertexFormatImplementationSpecific(). +In case of OpenGL, corresponds to a tuple of @ref GL::DynamicAttribute::Kind, +@ref GL::DynamicAttribute::Components and @ref GL::DynamicAttribute::DataType +and is convertible to them using +@ref GL::DynamicAttribute::DynamicAttribute(Kind, UnsignedInt, VertexFormat). +See documentation of each value for more information about the mapping. Note +that not every format is available on all targets, use +@ref GL::hasVertexFormat() 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::VertexFormat). See documentation of each +value for more information about the mapping. Note that not every format may be +available, use @ref Vk::hasVkFormat(Magnum::VertexFormat) 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); +for Metal, corresponds to @m_class{m-doc-external} [MTLVertexFormat](https://developer.apple.com/documentation/metal/mtlvertexformat?language=objc). +See documentation of each value for more information about the mapping. @see @ref Trade::MeshData, @ref Trade::MeshAttributeData, @ref Trade::MeshAttribute */ enum class VertexFormat: UnsignedInt { /* Zero reserved for an invalid type (but not being a named value) */ - /** @ref Float */ + /** + * @ref Float. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * @ref GL::DynamicAttribute::DataType::Float; + * @def_vk_keyword{FORMAT_R32_SFLOAT,Format}; + * @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} [MTLVertexFormatFloat](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatfloat?language=objc). + * @m_keywords{DXGI_FORMAT_R32_FLOAT MTLVertexFormatFloat} + */ Float = 1, - /** @ref Half */ + /** + * @ref Half. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * @ref GL::DynamicAttribute::DataType::Half; + * @def_vk_keyword{FORMAT_R16_SFLOAT,Format}; + * @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} [MTLVertexFormatHalf](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformathalf?language=objc). + * @m_keywords{DXGI_FORMAT_R16_FLOAT MTLVertexFormatHalf} + */ Half, - /** @ref Double */ + /** + * @ref Double. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Long + * @ref GL::DynamicAttribute::DataType::Double; + * @def_vk_keyword{FORMAT_R64_SFLOAT,Format}. No D3D or Metal equivalent. + */ Double, - /** @ref UnsignedByte */ + /** + * @ref UnsignedByte. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R8_UINT,Format}; + * @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} [MTLVertexFormatUChar](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuchar?language=objc) + * @m_keywords{DXGI_FORMAT_R8_UINT MTLVertexFormatUChar} + */ UnsignedByte, /** * @ref UnsignedByte, with range @f$ [0, 255] @f$ interpreted as * @f$ [0.0, 1.0] @f$. + * + * Corresponds to single-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R8_UNORM,Format}; + * @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} [MTLVertexFormatUCharNormalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatucharnormalized?language=objc). + * @m_keywords{DXGI_FORMAT_R8_UNORM MTLVertexFormatUCharNormalized} */ UnsignedByteNormalized, - /** @ref Byte */ + /** + * @ref Byte. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Byte; + * @def_vk_keyword{FORMAT_R8_SINT,Format}; + * @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} [MTLVertexFormatChar](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatchar?language=objc). + * @m_keywords{DXGI_FORMAT_R8_SINT MTLVertexFormatChar} + */ Byte, /** * @ref Byte, with range @f$ [-127, 127] @f$ interpreted as * @f$ [-1.0, 1.0] @f$. + * + * Corresponds to single-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::Byte; + * @def_vk_keyword{FORMAT_R8_SNORM,Format}; + * @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} [MTLVertexFormatCharNormalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatcharnormalized?language=objc). + * @m_keywords{DXGI_FORMAT_R8_SNORM MTLVertexFormatCharNormalized} */ ByteNormalized, - /** @ref UnsignedShort */ + /** + * @ref UnsignedShort. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedShort; + * @def_vk_keyword{FORMAT_R16_UINT,Format}; + * @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} [MTLVertexFormatUShort](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatushort?language=objc). + * @m_keywords{DXGI_FORMAT_R16_UINT MTLVertexFormatUShort} + */ UnsignedShort, /** * @ref UnsignedShort, with range @f$ [0, 65535] @f$ interpreted as * @f$ [0.0, 1.0] @f$. + * + * Corresponds to single-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R16_UNORM,Format}; + * @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} [MTLVertexFormatUShortNormalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatushortnormalized?language=objc). + * @m_keywords{DXGI_FORMAT_R16_UNORM MTLVertexFormatUShortNormalized} */ UnsignedShortNormalized, - /** @ref Short */ + /** + * @ref Short. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Short; + * @def_vk_keyword{FORMAT_R16_SINT,Format}; + * @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} [MTLVertexFormatShort](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatshort?language=objc). + * @m_keywords{DXGI_FORMAT_R16_SINT MTLVertexFormatShort} + */ Short, /** * @ref Short, with range @f$ [-32767, 32767] @f$ interpreted as * @f$ [-1.0, 1.0] @f$. + * + * Corresponds to single-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::Short; + * @def_vk_keyword{FORMAT_R16_SNORM,Format}; + * @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} [MTLVertexFormatShortNormalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatshortnormalized?language=objc). + * @m_keywords{DXGI_FORMAT_R16_SNORM MTLVertexFormatShortNormalized} */ ShortNormalized, - /** @ref UnsignedInt */ + /** + * @ref UnsignedInt. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedInt; + * @def_vk_keyword{FORMAT_R32_UINT,Format}; + * @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} [MTLVertexFormatUInt](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuint?language=objc). + * @m_keywords{DXGI_FORMAT_R32_UINT MTLVertexFormatUInt} + */ UnsignedInt, - /** @ref Int */ + /** + * @ref Int. + * + * Corresponds to single-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Int; + * @def_vk_keyword{FORMAT_R32_SINT,Format}; + * @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} [MTLVertexFormatInt](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatint?language=objc). + * @m_keywords{DXGI_FORMAT_R32_SINT MTLVertexFormatInt} + */ Int, /** * @ref Vector2. Usually used for 2D positions and 2D texture coordinates. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * @ref GL::DynamicAttribute::DataType::Float; + * @def_vk_keyword{FORMAT_R32G32_SFLOAT,Format}; + * @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} [MTLVertexFormatFloat2](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatfloat2?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32_FLOAT MTLVertexFormatFloat2} */ Vector2, /** * @ref Vector2h. Can be used instead of @ref VertexFormat::Vector2 for 2D * positions and 2D texture coordinates. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * @ref GL::DynamicAttribute::DataType::Half; + * @def_vk_keyword{FORMAT_R16G16_SFLOAT,Format}; + * @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} [MTLVertexFormatHalf2](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformathalf2?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16_FLOAT MTLVertexFormatHalf2} */ Vector2h, - /** @ref Vector2d */ + /** + * @ref Vector2d. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Long + * @ref GL::DynamicAttribute::DataType::Double; + * @def_vk_keyword{FORMAT_R64G64_SFLOAT,Format}. No D3D or Metal + * equivalent. + */ Vector2d, /** * @ref Vector2ub. Can be used instead of @ref VertexFormat::Vector2 for * packed 2D positions and 2D texture coordinates, in which case the range * @f$ [0, 255] @f$ is interpreted as @f$ [0.0, 255.0] @f$. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R8G8_UINT,Format}; + * @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} [MTLVertexFormatUChar2](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuchar2?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8_UINT MTLVertexFormatUChar2} */ Vector2ub, @@ -130,6 +294,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector2ub, with range @f$ [0, 255] @f$ interpreted as * @f$ [0.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector2 * for packed 2D positions and 2D texture coordinates. + * + * Corresponds to two-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R8G8_UNORM,Format}; + * @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} [MTLVertexFormatUChar2Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuchar2normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8_UNORM MTLVertexFormatUChar2Normalized} */ Vector2ubNormalized, @@ -137,6 +309,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector2b. Can be used instead of @ref VertexFormat::Vector2 for * packed 2D positions and 2D texture coordinates, in which case the range * @f$ [-128, 127] @f$ is interpreted as @f$ [-128.0, 127.0] @f$. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Byte; + * @def_vk_keyword{FORMAT_R8G8_SINT,Format}; + * @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} [MTLVertexFormatChar2](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatchar2?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8_SINT MTLVertexFormatChar2} */ Vector2b, @@ -144,6 +324,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector2b, with range @f$ [-127, 127] @f$ interpreted as * @f$ [-1.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector2 * for packed 2D positions and 2D texture coordinates. + * + * Corresponds to two-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::Byte; + * @def_vk_keyword{FORMAT_R8G8_SNORM,Format}; + * @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} [MTLVertexFormatChar2Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatchar2normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8_SNORM MTLVertexFormatChar2Normalized} */ Vector2bNormalized, @@ -151,6 +339,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector2us. Can be used instead of @ref VertexFormat::Vector2 for * packed 2D positions and 2D texture coordinates, in which case the range * @f$ [0, 65535] @f$ is interpreted as @f$ [0.0, 65535.0] @f$. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedShort; + * @def_vk_keyword{FORMAT_R16G16_UINT,Format}; + * @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} [MTLVertexFormatUShort2](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatushort2?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16_UINT MTLVertexFormatUShort2} */ Vector2us, @@ -158,6 +354,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector2us, with range @f$ [0, 65535] @f$ interpreted as * @f$ [0.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector2 * for packed 2D positions and 2D texture coordinates. + * + * Corresponds to two-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R16G16_UNORM,Format}; + * @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} [MTLVertexFormatUShort2Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatushort2normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16_UNORM MTLVertexFormatUShort2Normalized} */ Vector2usNormalized, @@ -165,6 +369,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector2s. Can be used instead of @ref VertexFormat::Vector2 for * packed 2D positions and 2D texture coordinates, in which case the range * @f$ [-32768, 32767] @f$ is interpreted as @f$ [-32768.0, 32767.0] @f$. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Short; + * @def_vk_keyword{FORMAT_R16G16_SINT,Format}; + * @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} [MTLVertexFormatShort2](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatshort2?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16_SINT MTLVertexFormatShort2} */ Vector2s, @@ -172,34 +384,92 @@ enum class VertexFormat: UnsignedInt { * @ref Vector2s, with range @f$ [-32767, 32767] @f$ interpreted as * @f$ [-1.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector2 * for packed 2D positions and 2D texture coordinates. + * + * Corresponds to two-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::Short; + * @def_vk_keyword{FORMAT_R16G16_SNORM,Format}; + * @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} [MTLVertexFormatShort2Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatshort2normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16_SNORM MTLVertexFormatShort2Normalized} */ Vector2sNormalized, - /** @ref Vector2ui */ + /** + * @ref Vector2ui. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedInt; + * @def_vk_keyword{FORMAT_R32G32_UINT,Format}; + * @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} [MTLVertexFormatUInt2](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuint2?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32_UINT MTLVertexFormatUInt2} + */ Vector2ui, - /** @ref Vector2i */ + /** + * @ref Vector2i. + * + * Corresponds to two-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Int; + * @def_vk_keyword{FORMAT_R32G32_SINT,Format}; + * @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} [MTLVertexFormatInt2](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatint2?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32_SINT MTLVertexFormatInt2} + */ Vector2i, /** * @ref Vector3 or @ref Color3. Usually used for 3D positions, normals and * three-component colors. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * @ref GL::DynamicAttribute::DataType::Float; + * @def_vk_keyword{FORMAT_R32G32B32_SFLOAT,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatFloat3](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatfloat3?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32B32_FLOAT MTLVertexFormatFloat3} */ Vector3, /** * @ref Vector3h. Can be used instead of @ref VertexFormat::Vector3 for * packed 3D positions and three-component colors. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * @ref GL::DynamicAttribute::DataType::Half; + * @def_vk_keyword{FORMAT_R16G16B16_SFLOAT,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16_FLOAT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatHalf3](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformathalf3?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16_FLOAT MTLVertexFormatHalf3} */ Vector3h, - /** @ref Vector3d */ + /** + * @ref Vector3d. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Long + * @ref GL::DynamicAttribute::DataType::Double; + * @def_vk_keyword{FORMAT_R64G64B64_SFLOAT,Format}. No D3D or Metal + * equivalent. + */ Vector3d, /** * @ref Vector3ub. Can be used instead of @ref VertexFormat::Vector3 for * packed 3D positions, in which case the range @f$ [0, 255] @f$ is * interpreted as @f$ [0.0, 255.0] @f$. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R8G8B8_UINT,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatUChar3](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuchar3?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8B8_UINT MTLVertexFormatUChar3} */ Vector3ub, @@ -207,6 +477,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector3ub, with range @f$ [0, 255] @f$ interpreted as * @f$ [0.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector3 * for packed 3D positions and three-component colors. + * + * Corresponds to three-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R8G8B8_UNORM,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatUChar3Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuchar3normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8B8_UNORM MTLVertexFormatUChar3Normalized} */ Vector3ubNormalized, @@ -214,6 +492,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector3b. Can be used instead of @ref VertexFormat::Vector3 for * packed 3D positions, in which case the range @f$ [-128, 127] @f$ is * interpreted as @f$ [-128.0, 127.0] @f$. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Byte; + * @def_vk_keyword{FORMAT_R8G8B8_SINT,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatChar3](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatchar3?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8B8_SINT MTLVertexFormatChar3} */ Vector3b, @@ -221,6 +507,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector3b, with range @f$ [-127, 127] @f$ interpreted as * @f$ [-1.0, 1.0] @f$. Can be used instead of * @ref VertexFormat::Vector3 for packed 3D positions and normals. + * + * Corresponds to three-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::Byte; + * @def_vk_keyword{FORMAT_R8G8B8_SNORM,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R8G8B8_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatChar3Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatchar3normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8B8_SNORM MTLVertexFormatChar3Normalized} */ Vector3bNormalized, @@ -228,6 +522,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector3us. Can be used instead of @ref VertexFormat::Vector3 for * packed 2D positions, in which case the range @f$ [0, 65535] @f$ is * interpreted as @f$ [0.0, 65535.0] @f$. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedShort; + * @def_vk_keyword{FORMAT_R16G16B16_UINT,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatUShort3](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatushort3?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16_UINT MTLVertexFormatUShort3} */ Vector3us, @@ -235,6 +537,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector3us, with range @f$ [0, 65535] @f$ interpreted as * @f$ [0.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector2 * for packed 3D positions and three-component colors. + * + * Corresponds to three-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R16G16B16_UNORM,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16_UNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatUShort3Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatushort3normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16_UNORM MTLVertexFormatUShort3Normalized} */ Vector3usNormalized, @@ -242,6 +552,14 @@ enum class VertexFormat: UnsignedInt { * @ref Vector3s. Can be used instead of @ref VertexFormat::Vector3 for * packed 3D positions, in which case the range @f$ [-32768, 32767] @f$ is * interpreted as @f$ [-32768.0, 32767.0] @f$. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Short; + * @def_vk_keyword{FORMAT_R16G16B16_SINT,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatShort3](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatshort3?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16_SINT MTLVertexFormatShort3} */ Vector3s, @@ -249,71 +567,213 @@ enum class VertexFormat: UnsignedInt { * @ref Vector3s, with range @f$ [-32767, 32767] @f$ interpreted as * @f$ [-1.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector3 * for packed 3D positions and normals. + * + * Corresponds to three-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::Short; + * @def_vk_keyword{FORMAT_R16G16B16_SNORM,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R16G16B16_SNORM](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatShort3Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatshort3normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16_SNORM MTLVertexFormatShort3Normalized} */ Vector3sNormalized, - /** @ref Vector3ui */ + /** + * @ref Vector3ui. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedInt; + * @def_vk_keyword{FORMAT_R32G32B32_UINT,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32_UINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatUInt3](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuint3?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32B32_UINT MTLVertexFormatUInt3} + */ Vector3ui, - /** @ref Vector3i */ + /** + * @ref Vector3i. + * + * Corresponds to three-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Int; + * @def_vk_keyword{FORMAT_R32G32B32_SINT,Format}; + * @m_class{m-doc-external} [DXGI_FORMAT_R32G32B32_SINT](https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format) + * or @m_class{m-doc-external} [MTLVertexFormatInt3](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatint3?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32B32_SINT MTLVertexFormatInt3} + */ Vector3i, /** * @ref Vector4 or @ref Color4. Usually used for four-component colors. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * @ref GL::DynamicAttribute::DataType::Float; + * @def_vk_keyword{FORMAT_R32G32B32A32_SFLOAT,Format}; + * @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} [MTLVertexFormatFloat4](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatfloat4?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32B32A32_FLOAT MTLVertexFormatFloat4} */ Vector4, /** * @ref Vector4h. Can be used instead of @ref VertexFormat::Vector4 for * four-component colors. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * @ref GL::DynamicAttribute::DataType::Half; + * @def_vk_keyword{FORMAT_R16G16B16A16_SFLOAT,Format}; + * @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} [MTLVertexFormatHalf4](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformathalf4?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16A16_FLOAT MTLVertexFormatHalf4} */ Vector4h, - /** @ref Vector4d */ + /** + * @ref Vector4d. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Long + * @ref GL::DynamicAttribute::DataType::Double; + * @def_vk_keyword{FORMAT_R64G64B64A64_SFLOAT,Format}. No D3D or Metal + * equivalent. + */ Vector4d, - /** @ref Vector4ub */ + /** + * @ref Vector4ub. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R8G8B8A8_UINT,Format}; + * @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} [MTLVertexFormatUChar4](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuchar4?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8B8A8_UINT MTLVertexFormatUChar4} + */ Vector4ub, /** * @ref Vector4ub, with range @f$ [0, 255] @f$ interpreted as * @f$ [0.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector4 * for packed linear four-component colors. + * + * Corresponds to four-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R8G8B8A8_UNORM,Format}; + * @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} [MTLVertexFormatUChar4Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuchar4normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8B8A8_UNORM MTLVertexFormatUChar4Normalized} */ Vector4ubNormalized, - /** @ref Vector4b */ + /** + * @ref Vector4b. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Byte; + * @def_vk_keyword{FORMAT_R8G8B8A8_SINT,Format}; + * @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} [MTLVertexFormatChar4](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatchar4?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8B8A8_SINT MTLVertexFormatChar4} + */ Vector4b, /** * @ref Vector4b, with range @f$ [-127, 127] @f$ interpreted as * @f$ [-1.0, 1.0] @f$. + * + * Corresponds to four-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::Byte; + * @def_vk_keyword{FORMAT_R8G8B8A8_SNORM,Format}; + * @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} [MTLVertexFormatChar4Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatchar4normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R8G8B8A8_SNORM MTLVertexFormatChar4Normalized} */ Vector4bNormalized, - /** @ref Vector4us */ + /** + * @ref Vector4us. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedShort; + * @def_vk_keyword{FORMAT_R16G16B16A16_UINT,Format}; + * @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} [MTLVertexFormatUShort4](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatushort4?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16A16_UINT MTLVertexFormatUShort4} + */ Vector4us, /** * @ref Vector4us, with range @f$ [0, 65535] @f$ interpreted as * @f$ [0.0, 1.0] @f$. Can be used instead of @ref VertexFormat::Vector4 * for packed linear four-component colors. + * + * Corresponds to four-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::UnsignedByte; + * @def_vk_keyword{FORMAT_R16G16B16A16_UNORM,Format}; + * @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} [MTLVertexFormatUShort4Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatushort4normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16A16_UNORM MTLVertexFormatUShort4Normalized} */ Vector4usNormalized, - /** @ref Vector4s */ + /** + * @ref Vector4s. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Short; + * @def_vk_keyword{FORMAT_R16G16B16A16_SINT,Format}; + * @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} [MTLVertexFormatShort4](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatshort4?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16A16_SINT MTLVertexFormatShort4} + */ Vector4s, /** * @ref Vector4s, with range @f$ [-32767, 32767] @f$ interpreted as * @f$ [-1.0, 1.0] @f$. + * + * Corresponds to four-component + * @ref GL::DynamicAttribute::Kind::GenericNormalized + * @ref GL::DynamicAttribute::DataType::Short; + * @def_vk_keyword{FORMAT_R16G16B16A16_SNORM,Format}; + * @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} [MTLVertexFormatShort4Normalized](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatshort4normalized?language=objc). + * @m_keywords{DXGI_FORMAT_R16G16B16A16_SNORM MTLVertexFormatShort4Normalized} */ Vector4sNormalized, - /** @ref Vector4ui */ + /** + * @ref Vector4ui. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::UnsignedInt; + * @def_vk_keyword{FORMAT_R32G32B32A16_UINT,Format}; + * @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} [MTLVertexFormatUInt4](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatuint4?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32B32A32_UINT MTLVertexFormatUInt4} + */ Vector4ui, - /** @ref Vector4i */ + /** + * @ref Vector4i. + * + * Corresponds to four-component @ref GL::DynamicAttribute::Kind::Generic + * or @ref GL::DynamicAttribute::Kind::Integral + * @ref GL::DynamicAttribute::DataType::Int; + * @def_vk_keyword{FORMAT_R32G32B32A32_SINT,Format}; + * @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} [MTLVertexFormatInt4](https://developer.apple.com/documentation/metal/mtlvertexformat/mtlvertexformatint4?language=objc). + * @m_keywords{DXGI_FORMAT_R32G32B32A32_SINT MTLVertexFormatInt4} + */ Vector4i }; diff --git a/src/Magnum/Vk/CMakeLists.txt b/src/Magnum/Vk/CMakeLists.txt index a2dcf4490..dc21ac4ba 100644 --- a/src/Magnum/Vk/CMakeLists.txt +++ b/src/Magnum/Vk/CMakeLists.txt @@ -42,7 +42,9 @@ set(MagnumVk_HEADERS visibility.h) set(MagnumVk_PRIVATE_HEADERS - Implementation/FormatMapping.hpp) + Implementation/compressedPixelFormatMapping.hpp + Implementation/meshAttributeTypeMapping.hpp + Implementation/pixelFormatMapping.hpp) # Objects shared between main and test library # add_library(MagnumVkObjects OBJECT diff --git a/src/Magnum/Vk/Enums.cpp b/src/Magnum/Vk/Enums.cpp index 6e8a69c47..47e236dd3 100644 --- a/src/Magnum/Vk/Enums.cpp +++ b/src/Magnum/Vk/Enums.cpp @@ -30,6 +30,7 @@ #include "Magnum/Mesh.h" #include "Magnum/PixelFormat.h" #include "Magnum/Sampler.h" +#include "Magnum/VertexFormat.h" namespace Magnum { namespace Vk { @@ -54,6 +55,14 @@ constexpr VkIndexType IndexTypeMapping[]{ #ifndef DOXYGEN_GENERATING_OUTPUT /* It gets *really* confused */ static_assert(VK_FORMAT_UNDEFINED == 0, "VK_FORMAT_UNDEFINED is assumed to be 0"); +constexpr VkFormat VertexFormatMapping[] { + #define _c(input, format) VK_FORMAT_ ## format, + #define _s(input) {}, + #include "Magnum/Vk/Implementation/vertexFormatMapping.hpp" + #undef _s + #undef _c +}; + constexpr VkFormat PixelFormatMapping[] { #define _c(input, format) VK_FORMAT_ ## format, #define _s(input) {}, @@ -122,6 +131,15 @@ VkIndexType vkIndexType(const Magnum::MeshIndexType type) { return out; } +bool hasVkFormat(const Magnum::VertexFormat format) { + if(isVertexFormatImplementationSpecific(format)) + return true; + + CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(VertexFormatMapping), + "Vk::hasVkFormat(): invalid format" << format, {}); + return UnsignedInt(VertexFormatMapping[UnsignedInt(format) - 1]); +} + bool hasVkFormat(const Magnum::PixelFormat format) { if(isPixelFormatImplementationSpecific(format)) return true; @@ -140,6 +158,18 @@ bool hasVkFormat(const Magnum::CompressedPixelFormat format) { return UnsignedInt(CompressedPixelFormatMapping[UnsignedInt(format) - 1]); } +VkFormat vkFormat(const Magnum::VertexFormat format) { + if(isVertexFormatImplementationSpecific(format)) + return vertexFormatUnwrap(format); + + CORRADE_ASSERT(UnsignedInt(format) - 1 < Containers::arraySize(VertexFormatMapping), + "Vk::vkFormat(): invalid format" << format, {}); + const VkFormat out = VertexFormatMapping[UnsignedInt(format) - 1]; + CORRADE_ASSERT(UnsignedInt(out), + "Vk::vkFormat(): unsupported format" << format, {}); + return out; +} + VkFormat vkFormat(const Magnum::PixelFormat format) { if(isPixelFormatImplementationSpecific(format)) return pixelFormatUnwrap(format); diff --git a/src/Magnum/Vk/Enums.h b/src/Magnum/Vk/Enums.h index 3c44b60fb..39f4ed7f0 100644 --- a/src/Magnum/Vk/Enums.h +++ b/src/Magnum/Vk/Enums.h @@ -79,6 +79,24 @@ of given index type. */ MAGNUM_VK_EXPORT VkIndexType vkIndexType(Magnum::MeshIndexType type); +/** +@brief Check availability of a generic vertex format +@m_since_latest + +Some Vulkan targets don't support all generic vertex formats. Returns +@cpp false @ce if current target can't support such format, @cpp true @ce +otherwise. Moreover, returns @cpp true @ce also for all formats that are +@ref isVertexFormatImplementationSpecific(). 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::VertexFormat) +*/ +MAGNUM_VK_EXPORT bool hasVkFormat(Magnum::VertexFormat format); + /** @brief Check availability of a generic pixel format @@ -92,7 +110,7 @@ be valid. 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() +@see @ref vkFormat(Magnum::PixelFormat) */ MAGNUM_VK_EXPORT bool hasVkFormat(Magnum::PixelFormat format); @@ -109,22 +127,38 @@ expected to be valid. 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() +@see @ref vkFormat(Magnum::CompressedPixelFormat) */ MAGNUM_VK_EXPORT bool hasVkFormat(Magnum::CompressedPixelFormat format); +/** +@brief Convert a generic vertex format to Vulkan format +@m_since_latest + +In case @ref isVertexFormatImplementationSpecific() returns @cpp false @ce for +@p format, maps it to a corresponding Vulkan format. In case +@ref isVertexFormatImplementationSpecific() returns @cpp true @ce, assumes +@p format stores a Vulkan-specific format and returns @ref vertexFormatUnwrap() +cast to @type_vk{Format}. + +Not all generic vertex formats may be available on all targets and this +function expects that given format is available on the target. Use +@ref hasVkFormat(Magnum::VertexFormat) to query availability of given format. +*/ +MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::VertexFormat format); + /** @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 Vulkan-specific format and returns @ref pixelFormatUnwrap() +@p format stores a Vulkan-specific format and returns @ref pixelFormatUnwrap() cast to @type_vk{Format}. Not all generic pixel formats may be available on all targets and this function -expects that given format is available on the target. Use @ref hasVkFormat() to -query availability of given format. +expects that given format is available on the target. Use +@ref hasVkFormat(Magnum::PixelFormat) to query availability of given format. */ MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::PixelFormat format); @@ -134,12 +168,13 @@ MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::PixelFormat 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 Vulkan-specific format and returns +assumes @p format stores a Vulkan-specific format and returns @ref compressedPixelFormatUnwrap() cast to @type_vk{Format}. Not all generic pixel formats may be available on all targets and this function -expects that given format is available on the target. Use @ref hasVkFormat() to -query availability of given format. +expects that given format is available on the target. Use +@ref hasVkFormat(Magnum::CompressedPixelFormat) to query availability of given +format. */ MAGNUM_VK_EXPORT VkFormat vkFormat(Magnum::CompressedPixelFormat format); diff --git a/src/Magnum/Vk/Implementation/vertexFormatMapping.hpp b/src/Magnum/Vk/Implementation/vertexFormatMapping.hpp new file mode 100644 index 000000000..2efe832bc --- /dev/null +++ b/src/Magnum/Vk/Implementation/vertexFormatMapping.hpp @@ -0,0 +1,80 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 + 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. +*/ + +/* See Magnum/Vk/Enums.cpp and Magnum/Vk/Test/EnumsTest.cpp */ +#ifdef _c +_c(Float, R32_SFLOAT) +_c(Half, R16_SFLOAT) +_c(Double, R64_SFLOAT) +_c(UnsignedByte, R8_UINT) +_c(UnsignedByteNormalized, R8_UNORM) +_c(Byte, R8_SINT) +_c(ByteNormalized, R8_SNORM) +_c(UnsignedShort, R16_UINT) +_c(UnsignedShortNormalized, R16_UNORM) +_c(Short, R16_SINT) +_c(ShortNormalized, R16_SNORM) +_c(UnsignedInt, R32_UINT) +_c(Int, R32_SINT) +_c(Vector2, R32G32_SFLOAT) +_c(Vector2h, R16G16_SFLOAT) +_c(Vector2d, R64G64_SFLOAT) +_c(Vector2ub, R8G8_UINT) +_c(Vector2ubNormalized, R8G8_UNORM) +_c(Vector2b, R8G8_SINT) +_c(Vector2bNormalized, R8G8_SNORM) +_c(Vector2us, R16G16_UINT) +_c(Vector2usNormalized, R16G16_UNORM) +_c(Vector2s, R16G16_SINT) +_c(Vector2sNormalized, R16G16_SNORM) +_c(Vector2ui, R32G32_UINT) +_c(Vector2i, R32G32_SINT) +_c(Vector3, R32G32B32_SFLOAT) +_c(Vector3h, R16G16B16_SFLOAT) +_c(Vector3d, R64G64B64_SFLOAT) +_c(Vector3ub, R8G8B8_UINT) +_c(Vector3ubNormalized, R8G8B8_UNORM) +_c(Vector3b, R8G8B8_SINT) +_c(Vector3bNormalized, R8G8B8_SNORM) +_c(Vector3us, R16G16B16_UINT) +_c(Vector3usNormalized, R16G16B16_UNORM) +_c(Vector3s, R16G16B16_SINT) +_c(Vector3sNormalized, R16G16B16_SNORM) +_c(Vector3ui, R32G32B32_UINT) +_c(Vector3i, R32G32B32_SINT) +_c(Vector4, R32G32B32A32_SFLOAT) +_c(Vector4h, R16G16B16A16_SFLOAT) +_c(Vector4d, R64G64B64A64_SFLOAT) +_c(Vector4ub, R8G8B8A8_UINT) +_c(Vector4ubNormalized, R8G8B8A8_UNORM) +_c(Vector4b, R8G8B8A8_SINT) +_c(Vector4bNormalized, R8G8B8A8_SNORM) +_c(Vector4us, R16G16B16A16_UINT) +_c(Vector4usNormalized, R16G16B16A16_UNORM) +_c(Vector4s, R16G16B16A16_SINT) +_c(Vector4sNormalized, R16G16B16A16_SNORM) +_c(Vector4ui, R32G32B32A32_UINT) +_c(Vector4i, R32G32B32A32_SINT) +#endif diff --git a/src/Magnum/Vk/Test/EnumsTest.cpp b/src/Magnum/Vk/Test/EnumsTest.cpp index 05cf72792..baea77c7d 100644 --- a/src/Magnum/Vk/Test/EnumsTest.cpp +++ b/src/Magnum/Vk/Test/EnumsTest.cpp @@ -30,6 +30,7 @@ #include "Magnum/Mesh.h" #include "Magnum/PixelFormat.h" #include "Magnum/Sampler.h" +#include "Magnum/VertexFormat.h" #include "Magnum/Vk/Enums.h" namespace Magnum { namespace Vk { namespace Test { namespace { @@ -45,6 +46,11 @@ struct EnumsTest: TestSuite::Tester { void mapVkIndexTypeUnsupported(); void mapVkIndexTypeInvalid(); + void mapVkFormatVertexFormat(); + void mapVkFormatVertexFormatImplementationSpecific(); + void mapVkFormatVertexFormatUnsupported(); + void mapVkFormatVertexFormatInvalid(); + void mapVkFormatPixelFormat(); void mapVkFormatPixelFormatImplementationSpecific(); void mapVkFormatPixelFormatUnsupported(); @@ -76,6 +82,11 @@ EnumsTest::EnumsTest() { &EnumsTest::mapVkIndexTypeUnsupported, &EnumsTest::mapVkIndexTypeInvalid, + &EnumsTest::mapVkFormatVertexFormat, + &EnumsTest::mapVkFormatVertexFormatImplementationSpecific, + &EnumsTest::mapVkFormatVertexFormatUnsupported, + &EnumsTest::mapVkFormatVertexFormatInvalid, + &EnumsTest::mapVkFormatPixelFormat, &EnumsTest::mapVkFormatPixelFormatImplementationSpecific, &EnumsTest::mapVkFormatPixelFormatUnsupported, @@ -228,6 +239,99 @@ void EnumsTest::mapVkIndexTypeInvalid() { "Vk::vkIndexType(): invalid type MeshIndexType(0x12)\n"); } +void EnumsTest::mapVkFormatVertexFormat() { + /* Touchstone verification */ + CORRADE_VERIFY(hasVkFormat(Magnum::VertexFormat::Vector3us)); + CORRADE_COMPARE(vkFormat(Magnum::VertexFormat::Vector3us), VK_FORMAT_R16G16B16_UINT); + + /* 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::VertexFormat(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 vertex 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::VertexFormat::format: \ + CORRADE_COMPARE(nextHandled, i); \ + CORRADE_COMPARE(firstUnhandled, 0xffff); \ + CORRADE_VERIFY(hasVkFormat(Magnum::VertexFormat::format)); \ + CORRADE_COMPARE(vkFormat(Magnum::VertexFormat::format), VK_FORMAT_ ## expectedFormat); \ + ++nextHandled; \ + continue; + #define _s(format) \ + case Magnum::VertexFormat::format: { \ + CORRADE_COMPARE(nextHandled, i); \ + CORRADE_COMPARE(firstUnhandled, 0xffff); \ + CORRADE_VERIFY(!hasVkFormat(Magnum::VertexFormat::format)); \ + std::ostringstream out; \ + { /* Redirected otherwise graceful assert would abort */ \ + Error redirectError{&out}; \ + vkFormat(Magnum::VertexFormat::format); \ + } \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + ++nextHandled; \ + continue; \ + } + #include "Magnum/Vk/Implementation/vertexFormatMapping.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::mapVkFormatVertexFormatImplementationSpecific() { + CORRADE_VERIFY(hasVkFormat(Magnum::vertexFormatWrap(VK_FORMAT_A8B8G8R8_SINT_PACK32))); + CORRADE_COMPARE(vkFormat(Magnum::vertexFormatWrap(VK_FORMAT_A8B8G8R8_SINT_PACK32)), + VK_FORMAT_A8B8G8R8_SINT_PACK32); +} + +void EnumsTest::mapVkFormatVertexFormatUnsupported() { + #if 1 + CORRADE_SKIP("All vertex formats are supported."); + #else + std::ostringstream out; + Error redirectError{&out}; + + vkFormat(Magnum::VertexFormat::Vector3d); + CORRADE_COMPARE(out.str(), "Vk::vkFormat(): unsupported format VertexFormat::Vector3d\n"); + #endif +} + +void EnumsTest::mapVkFormatVertexFormatInvalid() { + std::ostringstream out; + Error redirectError{&out}; + + hasVkFormat(Magnum::VertexFormat{}); + hasVkFormat(Magnum::VertexFormat(0x123)); + vkFormat(Magnum::VertexFormat{}); + vkFormat(Magnum::VertexFormat(0x123)); + CORRADE_COMPARE(out.str(), + "Vk::hasVkFormat(): invalid format VertexFormat(0x0)\n" + "Vk::hasVkFormat(): invalid format VertexFormat(0x123)\n" + "Vk::vkFormat(): invalid format VertexFormat(0x0)\n" + "Vk::vkFormat(): invalid format VertexFormat(0x123)\n"); +} + void EnumsTest::mapVkFormatPixelFormat() { /* Touchstone verification */ CORRADE_VERIFY(hasVkFormat(Magnum::PixelFormat::RGBA8Unorm));