Introduce usage of clang-format to format vulkan.hpp and the other sources.
This commit is contained in:
@@ -16,54 +16,61 @@
|
||||
// Compile test on device functions
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
static char const* AppName = "DeviceFunctions";
|
||||
static char const* EngineName = "Vulkan.hpp";
|
||||
static char const * AppName = "DeviceFunctions";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/)
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
try
|
||||
{
|
||||
vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1);
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo));
|
||||
vk::PhysicalDevice physicalDevice = instance->enumeratePhysicalDevices().front();
|
||||
vk::ApplicationInfo appInfo( AppName, 1, EngineName, 1, VK_API_VERSION_1_1 );
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique( vk::InstanceCreateInfo( {}, &appInfo ) );
|
||||
vk::PhysicalDevice physicalDevice = instance->enumeratePhysicalDevices().front();
|
||||
|
||||
// get the QueueFamilyProperties of the first PhysicalDevice
|
||||
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
|
||||
|
||||
// get the first index into queueFamiliyProperties which supports graphics
|
||||
size_t graphicsQueueFamilyIndex = std::distance(queueFamilyProperties.begin(),
|
||||
std::find_if(queueFamilyProperties.begin(),
|
||||
queueFamilyProperties.end(),
|
||||
[](vk::QueueFamilyProperties const& qfp) { return qfp.queueFlags & vk::QueueFlagBits::eGraphics; }));
|
||||
assert(graphicsQueueFamilyIndex < queueFamilyProperties.size());
|
||||
size_t graphicsQueueFamilyIndex = std::distance(
|
||||
queueFamilyProperties.begin(),
|
||||
std::find_if(
|
||||
queueFamilyProperties.begin(), queueFamilyProperties.end(), []( vk::QueueFamilyProperties const & qfp ) {
|
||||
return qfp.queueFlags & vk::QueueFlagBits::eGraphics;
|
||||
} ) );
|
||||
assert( graphicsQueueFamilyIndex < queueFamilyProperties.size() );
|
||||
|
||||
// create a UniqueDevice
|
||||
float queuePriority = 0.0f;
|
||||
vk::DeviceQueueCreateInfo deviceQueueCreateInfo(vk::DeviceQueueCreateFlags(), static_cast<uint32_t>(graphicsQueueFamilyIndex), 1, &queuePriority);
|
||||
vk::UniqueDevice device = physicalDevice.createDeviceUnique(vk::DeviceCreateInfo(vk::DeviceCreateFlags(), 1, &deviceQueueCreateInfo));
|
||||
float queuePriority = 0.0f;
|
||||
vk::DeviceQueueCreateInfo deviceQueueCreateInfo(
|
||||
vk::DeviceQueueCreateFlags(), static_cast<uint32_t>( graphicsQueueFamilyIndex ), 1, &queuePriority );
|
||||
vk::UniqueDevice device =
|
||||
physicalDevice.createDeviceUnique( vk::DeviceCreateInfo( vk::DeviceCreateFlags(), 1, &deviceQueueCreateInfo ) );
|
||||
|
||||
std::vector<uint8_t> data;
|
||||
device->getAccelerationStructureHandleNV<uint8_t>({}, data, vk::DispatchLoaderDynamic());
|
||||
device->getAccelerationStructureHandleNV<uint8_t>( {}, data, vk::DispatchLoaderDynamic() );
|
||||
|
||||
std::vector<vk::UniqueCommandBuffer>::allocator_type vectorAllocator;
|
||||
vk::UniqueCommandBuffer commandBuffer = std::move(device->allocateCommandBuffersUnique({}, vectorAllocator, vk::DispatchLoaderStatic()).front());
|
||||
vk::UniqueCommandBuffer commandBuffer =
|
||||
std::move( device->allocateCommandBuffersUnique( {}, vectorAllocator, vk::DispatchLoaderStatic() ).front() );
|
||||
|
||||
commandBuffer->begin(nullptr);
|
||||
commandBuffer->begin( nullptr );
|
||||
|
||||
std::vector<vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic>>::allocator_type dynamicVectorAllocator;
|
||||
vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic> dynamicCommandBuffer = std::move(device->allocateCommandBuffersUnique({}, dynamicVectorAllocator, vk::DispatchLoaderDynamic()).front());
|
||||
vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic> dynamicCommandBuffer = std::move(
|
||||
device->allocateCommandBuffersUnique( {}, dynamicVectorAllocator, vk::DispatchLoaderDynamic() ).front() );
|
||||
}
|
||||
catch (vk::SystemError const& err)
|
||||
catch ( vk::SystemError const & err )
|
||||
{
|
||||
std::cout << "vk::SystemError: " << err.what() << std::endl;
|
||||
exit(-1);
|
||||
exit( -1 );
|
||||
}
|
||||
catch (...)
|
||||
catch ( ... )
|
||||
{
|
||||
std::cout << "unknown error\n";
|
||||
exit(-1);
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -17,45 +17,46 @@
|
||||
|
||||
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/)
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
try
|
||||
{
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
|
||||
|
||||
vk::Instance instance = vk::createInstance({}, nullptr);
|
||||
vk::Instance instance = vk::createInstance( {}, nullptr );
|
||||
|
||||
// initialize function pointers for instance
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(instance);
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( instance );
|
||||
|
||||
// create a dispatcher, based on additional vkDevice/vkGetDeviceProcAddr
|
||||
std::vector<vk::PhysicalDevice> physicalDevices = instance.enumeratePhysicalDevices();
|
||||
assert(!physicalDevices.empty());
|
||||
assert( !physicalDevices.empty() );
|
||||
|
||||
vk::Device device = physicalDevices[0].createDevice({}, nullptr);
|
||||
vk::Device device = physicalDevices[0].createDevice( {}, nullptr );
|
||||
|
||||
// function pointer specialization for device
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(device);
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( device );
|
||||
}
|
||||
catch (vk::SystemError const& err)
|
||||
catch ( vk::SystemError const & err )
|
||||
{
|
||||
std::cout << "vk::SystemError: " << err.what() << std::endl;
|
||||
exit(-1);
|
||||
exit( -1 );
|
||||
}
|
||||
catch (...)
|
||||
catch ( ... )
|
||||
{
|
||||
std::cout << "unknown error\n";
|
||||
exit(-1);
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -16,39 +16,40 @@
|
||||
// Compile test on using std::hash on handles
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
static char const* AppName = "Hash";
|
||||
static char const* EngineName = "Vulkan.hpp";
|
||||
static char const * AppName = "Hash";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/)
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
try
|
||||
{
|
||||
vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1);
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo));
|
||||
vk::ApplicationInfo appInfo( AppName, 1, EngineName, 1, VK_API_VERSION_1_1 );
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique( vk::InstanceCreateInfo( {}, &appInfo ) );
|
||||
|
||||
auto h1 = std::hash<vk::Instance>{}(*instance);
|
||||
auto h2 = std::hash<VkInstance>{}(*instance);
|
||||
assert(h1 == h2);
|
||||
auto h1 = std::hash<vk::Instance>{}( *instance );
|
||||
auto h2 = std::hash<VkInstance>{}( *instance );
|
||||
assert( h1 == h2 );
|
||||
|
||||
std::unordered_set<vk::Instance> uset;
|
||||
uset.insert(*instance);
|
||||
uset.insert( *instance );
|
||||
|
||||
std::unordered_map<vk::Instance, size_t> umap;
|
||||
umap[*instance] = 1;
|
||||
}
|
||||
catch (vk::SystemError const& err)
|
||||
catch ( vk::SystemError const & err )
|
||||
{
|
||||
std::cout << "vk::SystemError: " << err.what() << std::endl;
|
||||
exit(-1);
|
||||
exit( -1 );
|
||||
}
|
||||
catch (...)
|
||||
catch ( ... )
|
||||
{
|
||||
std::cout << "unknown error\n";
|
||||
exit(-1);
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -20,47 +20,61 @@
|
||||
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
static char const* AppName = "NoExceptions";
|
||||
static char const* EngineName = "Vulkan.hpp";
|
||||
static char const * AppName = "NoExceptions";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/)
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
|
||||
|
||||
vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1);
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo)).value;
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(*instance);
|
||||
vk::ApplicationInfo appInfo( AppName, 1, EngineName, 1, VK_API_VERSION_1_1 );
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique( vk::InstanceCreateInfo( {}, &appInfo ) ).value;
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( *instance );
|
||||
|
||||
std::vector<vk::PhysicalDevice> physicalDevices = instance->enumeratePhysicalDevices().value;
|
||||
assert(!physicalDevices.empty());
|
||||
assert( !physicalDevices.empty() );
|
||||
|
||||
// get the QueueFamilyProperties of the first PhysicalDevice
|
||||
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevices[0].getQueueFamilyProperties();
|
||||
|
||||
// get the first index into queueFamiliyProperties which supports graphics
|
||||
size_t graphicsQueueFamilyIndex = std::distance(queueFamilyProperties.begin(),
|
||||
std::find_if(queueFamilyProperties.begin(),
|
||||
queueFamilyProperties.end(),
|
||||
[](vk::QueueFamilyProperties const& qfp) { return qfp.queueFlags & vk::QueueFlagBits::eGraphics; }));
|
||||
assert(graphicsQueueFamilyIndex < queueFamilyProperties.size());
|
||||
size_t graphicsQueueFamilyIndex = std::distance( queueFamilyProperties.begin(),
|
||||
std::find_if( queueFamilyProperties.begin(),
|
||||
queueFamilyProperties.end(),
|
||||
[]( vk::QueueFamilyProperties const & qfp ) {
|
||||
return qfp.queueFlags & vk::QueueFlagBits::eGraphics;
|
||||
} ) );
|
||||
assert( graphicsQueueFamilyIndex < queueFamilyProperties.size() );
|
||||
|
||||
// create a UniqueDevice
|
||||
float queuePriority = 0.0f;
|
||||
vk::DeviceQueueCreateInfo deviceQueueCreateInfo(vk::DeviceQueueCreateFlags(), static_cast<uint32_t>(graphicsQueueFamilyIndex), 1, &queuePriority);
|
||||
vk::UniqueDevice device = physicalDevices[0].createDeviceUnique(vk::DeviceCreateInfo(vk::DeviceCreateFlags(), 1, &deviceQueueCreateInfo)).value;
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(*device);
|
||||
float queuePriority = 0.0f;
|
||||
vk::DeviceQueueCreateInfo deviceQueueCreateInfo(
|
||||
vk::DeviceQueueCreateFlags(), static_cast<uint32_t>( graphicsQueueFamilyIndex ), 1, &queuePriority );
|
||||
vk::UniqueDevice device =
|
||||
physicalDevices[0]
|
||||
.createDeviceUnique( vk::DeviceCreateInfo( vk::DeviceCreateFlags(), 1, &deviceQueueCreateInfo ) )
|
||||
.value;
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( *device );
|
||||
|
||||
// create a UniqueCommandPool to allocate a CommandBuffer from
|
||||
vk::UniqueCommandPool commandPool = device->createCommandPoolUnique(vk::CommandPoolCreateInfo(vk::CommandPoolCreateFlags(), deviceQueueCreateInfo.queueFamilyIndex)).value;
|
||||
vk::UniqueCommandPool commandPool = device
|
||||
->createCommandPoolUnique( vk::CommandPoolCreateInfo(
|
||||
vk::CommandPoolCreateFlags(), deviceQueueCreateInfo.queueFamilyIndex ) )
|
||||
.value;
|
||||
|
||||
// allocate a CommandBuffer from the CommandPool
|
||||
vk::UniqueCommandBuffer commandBuffer = std::move(device->allocateCommandBuffersUnique(vk::CommandBufferAllocateInfo(commandPool.get(), vk::CommandBufferLevel::ePrimary, 1)).value.front());
|
||||
vk::UniqueCommandBuffer commandBuffer = std::move( device
|
||||
->allocateCommandBuffersUnique( vk::CommandBufferAllocateInfo(
|
||||
commandPool.get(), vk::CommandBufferLevel::ePrimary, 1 ) )
|
||||
.value.front() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,15 +18,16 @@
|
||||
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
static char const* AppName = "StructureChain";
|
||||
static char const* EngineName = "Vulkan.hpp";
|
||||
static char const * AppName = "StructureChain";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4189 )
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( disable : 4189 )
|
||||
#elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#else
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
@@ -34,93 +35,106 @@ static char const* EngineName = "Vulkan.hpp";
|
||||
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
|
||||
|
||||
template <typename T>
|
||||
void unused(T const&)
|
||||
void unused( T const & )
|
||||
{}
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/)
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
try
|
||||
{
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
|
||||
|
||||
vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1);
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo));
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(*instance);
|
||||
vk::ApplicationInfo appInfo( AppName, 1, EngineName, 1, VK_API_VERSION_1_1 );
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique( vk::InstanceCreateInfo( {}, &appInfo ) );
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( *instance );
|
||||
vk::PhysicalDevice physicalDevice = instance->enumeratePhysicalDevices().front();
|
||||
|
||||
// some valid StructureChains
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2> sc0;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties> sc1;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceMaintenance3Properties> sc2;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2> sc0;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties> sc1;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceMaintenance3Properties> sc2;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDevicePushDescriptorPropertiesKHR> sc3;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties> sc4;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties, vk::PhysicalDevicePushDescriptorPropertiesKHR> sc6;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties, vk::PhysicalDevicePushDescriptorPropertiesKHR> sc7;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2,
|
||||
vk::PhysicalDeviceIDProperties,
|
||||
vk::PhysicalDeviceMaintenance3Properties>
|
||||
sc4;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2,
|
||||
vk::PhysicalDeviceIDProperties,
|
||||
vk::PhysicalDevicePushDescriptorPropertiesKHR>
|
||||
sc6;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2,
|
||||
vk::PhysicalDeviceIDProperties,
|
||||
vk::PhysicalDeviceMaintenance3Properties,
|
||||
vk::PhysicalDevicePushDescriptorPropertiesKHR>
|
||||
sc7;
|
||||
|
||||
// some invalid StructureChains
|
||||
//vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties> x;
|
||||
//vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties, vk::PhysicalDevicePushDescriptorPropertiesKHR> x;
|
||||
//vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDevicePushDescriptorPropertiesKHR, vk::PhysicalDeviceMaintenance3Properties> x;
|
||||
//vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceIDProperties> x;
|
||||
//vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceProperties2> x;
|
||||
// vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties> x;
|
||||
// vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties,
|
||||
// vk::PhysicalDevicePushDescriptorPropertiesKHR> x; vk::StructureChain<vk::PhysicalDeviceIDProperties,
|
||||
// vk::PhysicalDevicePushDescriptorPropertiesKHR, vk::PhysicalDeviceMaintenance3Properties> x;
|
||||
// vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceIDProperties>
|
||||
// x; vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceProperties2> x;
|
||||
|
||||
// unlink a struct from a StructureChain
|
||||
sc7.unlink<vk::PhysicalDeviceMaintenance3Properties>();
|
||||
|
||||
// some invalid unlink calls
|
||||
//sc7.unlink<vk::PhysicalDeviceMaintenance3Properties>(); // assertion fires on trying to unlink some already unlinked structure
|
||||
//sc7.unlink<vk::PhysicalDeviceProperties2>();
|
||||
//sc1.unlink<vk::PhysicalDeviceMaintenance3Properties>();
|
||||
// sc7.unlink<vk::PhysicalDeviceMaintenance3Properties>(); // assertion fires on trying to unlink some already
|
||||
// unlinked structure sc7.unlink<vk::PhysicalDeviceProperties2>();
|
||||
// sc1.unlink<vk::PhysicalDeviceMaintenance3Properties>();
|
||||
|
||||
// re-link a struct
|
||||
sc7.relink<vk::PhysicalDeviceMaintenance3Properties>();
|
||||
|
||||
// invalid re-linking
|
||||
//sc7.relink<vk::PhysicalDeviceProperties2>();
|
||||
//sc1.relink<vk::PhysicalDeviceMaintenance3Properties>();
|
||||
//sc1.relink<vk::PhysicalDeviceIDProperties>(); // assertion fires on trying to relink some structure that hasn't been unlinked
|
||||
// sc7.relink<vk::PhysicalDeviceProperties2>();
|
||||
// sc1.relink<vk::PhysicalDeviceMaintenance3Properties>();
|
||||
// sc1.relink<vk::PhysicalDeviceIDProperties>(); // assertion fires on trying to relink some structure
|
||||
// that hasn't been unlinked
|
||||
|
||||
// simple call, passing structures in
|
||||
vk::PhysicalDeviceFeatures2 pdf;
|
||||
physicalDevice.getFeatures2(&pdf);
|
||||
physicalDevice.getFeatures2( &pdf );
|
||||
|
||||
// simple calls, getting structure back
|
||||
vk::PhysicalDeviceFeatures2 a = physicalDevice.getFeatures2();
|
||||
unused(a);
|
||||
unused( a );
|
||||
|
||||
// complex calls, getting StructureChain back
|
||||
auto c = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
vk::PhysicalDeviceFeatures2 & c0 = c.get<vk::PhysicalDeviceFeatures2>();
|
||||
unused(c0);
|
||||
unused( c0 );
|
||||
|
||||
auto t0 = c.get<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
unused(t0);
|
||||
|
||||
unused( t0 );
|
||||
|
||||
auto d = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
vk::PhysicalDeviceFeatures2 & d0 = d.get<vk::PhysicalDeviceFeatures2>();
|
||||
unused(d0);
|
||||
unused( d0 );
|
||||
vk::PhysicalDeviceVariablePointerFeatures & d1 = d.get<vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
unused(d1);
|
||||
unused( d1 );
|
||||
|
||||
auto t1 = d.get<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
unused(t1);
|
||||
unused( t1 );
|
||||
|
||||
using StructureChain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
|
||||
using AllocatorType = std::vector<StructureChain>::allocator_type;
|
||||
auto qfd = physicalDevice.getQueueFamilyProperties2<StructureChain, AllocatorType>(VULKAN_HPP_DEFAULT_DISPATCHER);
|
||||
unused(qfd);
|
||||
using AllocatorType = std::vector<StructureChain>::allocator_type;
|
||||
auto qfd = physicalDevice.getQueueFamilyProperties2<StructureChain, AllocatorType>( VULKAN_HPP_DEFAULT_DISPATCHER );
|
||||
unused( qfd );
|
||||
}
|
||||
catch (vk::SystemError const& err)
|
||||
catch ( vk::SystemError const & err )
|
||||
{
|
||||
std::cout << "vk::SystemError: " << err.what() << std::endl;
|
||||
exit(-1);
|
||||
exit( -1 );
|
||||
}
|
||||
catch (...)
|
||||
catch ( ... )
|
||||
{
|
||||
std::cout << "unknown error\n";
|
||||
exit(-1);
|
||||
exit( -1 );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
#if defined( __x86_64__ ) || defined( _M_X64 )
|
||||
// On 32-bit systems the test is ambiguous.
|
||||
void test()
|
||||
{
|
||||
VkSurfaceKHR surface = 0;
|
||||
auto uniqueSurface = vk::UniqueSurfaceKHR(surface, vk::Instance());
|
||||
VkSurfaceKHR surface = 0;
|
||||
auto uniqueSurface = vk::UniqueSurfaceKHR( surface, vk::Instance() );
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user