mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-22 20:30:04 +00:00
Make test/FormatTraits.cpp valid for C++11.
This commit is contained in:
parent
1f697d86cb
commit
7e6083e5b2
@ -14,24 +14,22 @@
|
||||
|
||||
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
|
||||
)
|
||||
)
|
||||
|
||||
source_group(headers FILES ${HEADERS})
|
||||
source_group(sources FILES ${SOURCES})
|
||||
source_group(headers FILES ${HEADERS})
|
||||
source_group(sources FILES ${SOURCES})
|
||||
|
||||
add_executable(FormatTraits
|
||||
add_executable(FormatTraits
|
||||
${HEADERS}
|
||||
${SOURCES}
|
||||
)
|
||||
)
|
||||
|
||||
set_target_properties(FormatTraits PROPERTIES FOLDER "Tests")
|
||||
target_link_libraries(FormatTraits "${Vulkan_LIBRARIES}")
|
||||
endif()
|
||||
set_target_properties(FormatTraits PROPERTIES FOLDER "Tests")
|
||||
target_link_libraries(FormatTraits "${Vulkan_LIBRARIES}")
|
||||
|
@ -19,7 +19,11 @@
|
||||
|
||||
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 !" );
|
||||
#endif
|
||||
|
||||
vk::Format format = vk::Format::eR4G4UnormPack8;
|
||||
if ( vk::texelsPerBlock( format ) == 1 )
|
||||
@ -35,7 +39,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
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 ?" );
|
||||
#endif
|
||||
|
||||
assert( vk::packed( format ) == 8 );
|
||||
|
||||
@ -45,7 +53,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
}
|
||||
|
||||
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 !" );
|
||||
#endif
|
||||
assert( vk::componentCount( constFormat ) == 2 );
|
||||
|
||||
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" );
|
||||
|
||||
#if VULKAN_HPP_CPP_VERSION < 14
|
||||
assert( vk::componentPlaneIndex( constFormat, 8 ) == 0 );
|
||||
#else
|
||||
static_assert( vk::componentPlaneIndex( constFormat, 8 ) == 0, "Hoo" );
|
||||
#endif
|
||||
|
||||
if ( vk::planeCount( format ) != 1 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user