2019-10-28 14:36:21 +00:00
|
|
|
// Copyright(c) 2019, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
// VulkanHpp Samples : InstanceVersion
|
|
|
|
// Get the version of instance-level functionality supported by the implementation.
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
2022-08-10 09:19:06 +00:00
|
|
|
#include <vulkan/vulkan.hpp>
|
2019-10-28 14:36:21 +00:00
|
|
|
|
2020-04-12 19:49:12 +00:00
|
|
|
std::string decodeAPIVersion( uint32_t apiVersion )
|
2019-10-28 14:36:21 +00:00
|
|
|
{
|
2022-02-28 09:11:04 +00:00
|
|
|
return std::to_string( VK_VERSION_MAJOR( apiVersion ) ) + "." + std::to_string( VK_VERSION_MINOR( apiVersion ) ) + "." +
|
|
|
|
std::to_string( VK_VERSION_PATCH( apiVersion ) );
|
2019-10-28 14:36:21 +00:00
|
|
|
}
|
|
|
|
|
2020-04-12 19:49:12 +00:00
|
|
|
int main( int /*argc*/, char ** /*argv*/ )
|
2019-10-28 14:36:21 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
/* VULKAN_KEY_START */
|
|
|
|
|
|
|
|
uint32_t apiVersion = vk::enumerateInstanceVersion();
|
2021-02-17 09:49:59 +00:00
|
|
|
std::cout << "APIVersion = " << decodeAPIVersion( apiVersion ) << std::endl;
|
2019-10-28 14:36:21 +00:00
|
|
|
|
|
|
|
/* VULKAN_KEY_END */
|
|
|
|
}
|
2020-04-12 19:49:12 +00:00
|
|
|
catch ( vk::SystemError & err )
|
2019-10-28 14:36:21 +00:00
|
|
|
{
|
|
|
|
std::cout << "vk::SystemError: " << err.what() << std::endl;
|
2020-04-12 19:49:12 +00:00
|
|
|
exit( -1 );
|
2019-10-28 14:36:21 +00:00
|
|
|
}
|
2020-07-08 08:58:37 +00:00
|
|
|
catch ( std::exception & err )
|
2019-10-28 14:36:21 +00:00
|
|
|
{
|
2020-07-08 08:58:37 +00:00
|
|
|
std::cout << "std::exception: " << err.what() << std::endl;
|
2020-04-12 19:49:12 +00:00
|
|
|
exit( -1 );
|
2019-10-28 14:36:21 +00:00
|
|
|
}
|
2020-04-12 19:49:12 +00:00
|
|
|
catch ( ... )
|
2019-10-28 14:36:21 +00:00
|
|
|
{
|
|
|
|
std::cout << "unknown error\n";
|
2020-04-12 19:49:12 +00:00
|
|
|
exit( -1 );
|
2019-10-28 14:36:21 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|