mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #1229 from asuessenbach/format
Make test/FormatTraits.cpp valid for C++11.
This commit is contained in:
commit
e8c6a3c682
@ -14,24 +14,22 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
if (NOT TESTS_BUILD_ONLY_DYNAMIC)
|
project(FormatTraits)
|
||||||
project(FormatTraits)
|
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
FormatTraits.cpp
|
FormatTraits.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
source_group(headers FILES ${HEADERS})
|
source_group(headers FILES ${HEADERS})
|
||||||
source_group(sources FILES ${SOURCES})
|
source_group(sources FILES ${SOURCES})
|
||||||
|
|
||||||
add_executable(FormatTraits
|
add_executable(FormatTraits
|
||||||
${HEADERS}
|
${HEADERS}
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(FormatTraits PROPERTIES FOLDER "Tests")
|
set_target_properties(FormatTraits PROPERTIES FOLDER "Tests")
|
||||||
target_link_libraries(FormatTraits "${Vulkan_LIBRARIES}")
|
target_link_libraries(FormatTraits "${Vulkan_LIBRARIES}")
|
||||||
endif()
|
|
||||||
|
@ -19,7 +19,11 @@
|
|||||||
|
|
||||||
int main( int /*argc*/, char ** /*argv*/ )
|
int main( int /*argc*/, char ** /*argv*/ )
|
||||||
{
|
{
|
||||||
|
#if VULKAN_HPP_CPP_VERSION < 14
|
||||||
|
assert( vk::blockSize( vk::Format::eR4G4UnormPack8 ) == 1 );
|
||||||
|
#else
|
||||||
static_assert( vk::blockSize( vk::Format::eR4G4UnormPack8 ) == 1, "Wrong blocksize !" );
|
static_assert( vk::blockSize( vk::Format::eR4G4UnormPack8 ) == 1, "Wrong blocksize !" );
|
||||||
|
#endif
|
||||||
|
|
||||||
vk::Format format = vk::Format::eR4G4UnormPack8;
|
vk::Format format = vk::Format::eR4G4UnormPack8;
|
||||||
if ( vk::texelsPerBlock( format ) == 1 )
|
if ( vk::texelsPerBlock( format ) == 1 )
|
||||||
@ -35,7 +39,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
format = vk::Format::eR4G4UnormPack8;
|
format = vk::Format::eR4G4UnormPack8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VULKAN_HPP_CPP_VERSION < 14
|
||||||
|
assert( vk::isCompressed( vk::Format::eBc1RgbSrgbBlock ) );
|
||||||
|
#else
|
||||||
static_assert( vk::isCompressed( vk::Format::eBc1RgbSrgbBlock ), "IsCompressed ?" );
|
static_assert( vk::isCompressed( vk::Format::eBc1RgbSrgbBlock ), "IsCompressed ?" );
|
||||||
|
#endif
|
||||||
|
|
||||||
assert( vk::packed( format ) == 8 );
|
assert( vk::packed( format ) == 8 );
|
||||||
|
|
||||||
@ -45,7 +53,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
}
|
}
|
||||||
|
|
||||||
constexpr vk::Format constFormat = vk::Format::eR4G4UnormPack8;
|
constexpr vk::Format constFormat = vk::Format::eR4G4UnormPack8;
|
||||||
|
#if VULKAN_HPP_CPP_VERSION < 14
|
||||||
|
assert( vk::componentBits( constFormat, 1 ) == 4 );
|
||||||
|
#else
|
||||||
static_assert( vk::componentBits( constFormat, 1 ) == 4, "Wrong component bits !" );
|
static_assert( vk::componentBits( constFormat, 1 ) == 4, "Wrong component bits !" );
|
||||||
|
#endif
|
||||||
assert( vk::componentCount( constFormat ) == 2 );
|
assert( vk::componentCount( constFormat ) == 2 );
|
||||||
|
|
||||||
if ( strcmp( vk::componentName( constFormat, 0 ), "R" ) == 0 )
|
if ( strcmp( vk::componentName( constFormat, 0 ), "R" ) == 0 )
|
||||||
@ -55,7 +67,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
|
|
||||||
assert( std::string( vk::componentNumericFormat( constFormat, 1 ) ) == "UNORM" );
|
assert( std::string( vk::componentNumericFormat( constFormat, 1 ) ) == "UNORM" );
|
||||||
|
|
||||||
|
#if VULKAN_HPP_CPP_VERSION < 14
|
||||||
|
assert( vk::componentPlaneIndex( constFormat, 8 ) == 0 );
|
||||||
|
#else
|
||||||
static_assert( vk::componentPlaneIndex( constFormat, 8 ) == 0, "Hoo" );
|
static_assert( vk::componentPlaneIndex( constFormat, 8 ) == 0, "Hoo" );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( vk::planeCount( format ) != 1 )
|
if ( vk::planeCount( format ) != 1 )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user