Change ColumnLimit with clang-format from 120 to 160.
This commit is contained in:
@@ -16,16 +16,15 @@
|
||||
// Compile test on using vk::ArrayProxyNoTemporaries
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
static char const* AppName = "ArrayProxyNoTemporaries";
|
||||
static char const* EngineName = "Vulkan.hpp";
|
||||
static char const * AppName = "ArrayProxyNoTemporaries";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
void fct(vk::ArrayProxyNoTemporaries<int> /*ap*/)
|
||||
{}
|
||||
void fct( vk::ArrayProxyNoTemporaries<int> /*ap*/ ) {}
|
||||
|
||||
void fctc(vk::ArrayProxyNoTemporaries<const int> /*ap*/)
|
||||
{}
|
||||
void fctc( vk::ArrayProxyNoTemporaries<const int> /*ap*/ ) {}
|
||||
|
||||
int getInt()
|
||||
{
|
||||
@@ -70,11 +69,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
vk::enumerateInstanceVersion();
|
||||
|
||||
// nullptr_t
|
||||
fct(nullptr);
|
||||
fctc(nullptr);
|
||||
fct( nullptr );
|
||||
fctc( nullptr );
|
||||
|
||||
vk::ArrayProxyNoTemporaries<int> ap0 = nullptr;
|
||||
assert(ap0.size() == 0);
|
||||
assert( ap0.size() == 0 );
|
||||
|
||||
// Type
|
||||
// fct(2); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<int>(int &&)
|
||||
@@ -85,42 +84,42 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
// fctc( getInt() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<T,0>(int &&)
|
||||
|
||||
int i0 = 1;
|
||||
fct(i0);
|
||||
fctc(i0);
|
||||
fct( i0 );
|
||||
fctc( i0 );
|
||||
|
||||
const int i1 = 2;
|
||||
// fct(i1); // not supported: ArrayProxyNoTemporaries<const int&>(const int &)
|
||||
fctc(i1);
|
||||
fctc( i1 );
|
||||
|
||||
// count, T *
|
||||
int* i0p = &i0;
|
||||
fct({ 1, i0p });
|
||||
fctc({ 1, i0p });
|
||||
int * i0p = &i0;
|
||||
fct( { 1, i0p } );
|
||||
fctc( { 1, i0p } );
|
||||
|
||||
// count, T const*
|
||||
int const* i1p = &i1;
|
||||
int const * i1p = &i1;
|
||||
// fct({ 1, i1p }); // not supported: cannot convert argument 1 from 'initializer list' to 'vk::ArrayProxyNoTemporaries<int>'
|
||||
fctc({ 1, i1p });
|
||||
fctc( { 1, i1p } );
|
||||
|
||||
// std::array<T,N>
|
||||
std::array<int, 2> sa0 = { 0, 1 };
|
||||
fct(sa0);
|
||||
fctc(sa0);
|
||||
fct( sa0 );
|
||||
fctc( sa0 );
|
||||
|
||||
// std::array<const T,N>
|
||||
std::array<const int, 2> sa1 = { 0, 1 };
|
||||
// fct(sa1); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<std::array<const int,2>&>(V)
|
||||
fctc(sa1);
|
||||
fctc( sa1 );
|
||||
|
||||
// std::array<T,N> const
|
||||
std::array<int, 2> const sa2 = { 1, 2 };
|
||||
// fct(sa2); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::array<int,2>&>(V)
|
||||
fctc(sa2);
|
||||
fctc( sa2 );
|
||||
|
||||
// std::array<const T,N> const
|
||||
std::array<const int, 2> const sa3 = { 1, 2 };
|
||||
// fct(sa3); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::array<const int,2>&>(V)
|
||||
fctc(sa3);
|
||||
fctc( sa3 );
|
||||
|
||||
// getArray
|
||||
// fct( getConstArray() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::array<int,2>>(V &&)
|
||||
@@ -130,48 +129,51 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
// from std::array constructors
|
||||
vk::ArrayProxyNoTemporaries<int> ap2 = sa0;
|
||||
assert(ap2.size() == 2);
|
||||
// vk::ArrayProxyNoTemporaries<int> ap3 = sa1; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<std::array<const int,2>&>(V)
|
||||
// vk::ArrayProxyNoTemporaries<int> ap4 = sa2; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::array<int,2>&>(V)
|
||||
// vk::ArrayProxyNoTemporaries<int> ap5 = sa3; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::array<const int,2>&>(V)
|
||||
assert( ap2.size() == 2 );
|
||||
// vk::ArrayProxyNoTemporaries<int> ap3 = sa1; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<std::array<const
|
||||
// int,2>&>(V) vk::ArrayProxyNoTemporaries<int> ap4 = sa2; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const
|
||||
// std::array<int,2>&>(V) vk::ArrayProxyNoTemporaries<int> ap5 = sa3; // not supported: attempting to reference a deleted function:
|
||||
// ArrayProxyNoTemporaries<const std::array<const int,2>&>(V)
|
||||
|
||||
vk::ArrayProxyNoTemporaries<const int> ap6 = sa0;
|
||||
assert(ap6.size() == 2);
|
||||
assert( ap6.size() == 2 );
|
||||
vk::ArrayProxyNoTemporaries<const int> ap7 = sa1;
|
||||
assert(ap7.size() == 2);
|
||||
assert( ap7.size() == 2 );
|
||||
vk::ArrayProxyNoTemporaries<const int> ap8 = sa2;
|
||||
assert(ap8.size() == 2);
|
||||
assert( ap8.size() == 2 );
|
||||
vk::ArrayProxyNoTemporaries<const int> ap9 = sa3;
|
||||
assert(ap9.size() == 2);
|
||||
assert( ap9.size() == 2 );
|
||||
|
||||
// std::vector<T>
|
||||
std::vector<int> sv0 = { 0, 1 };
|
||||
fct(sv0);
|
||||
fctc(sv0);
|
||||
fct( sv0 );
|
||||
fctc( sv0 );
|
||||
|
||||
// std::vector<T> const
|
||||
std::vector<int> const sv1 = { 0, 1 };
|
||||
// fct(sv1); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::vector<int,std::allocator<int>>&>(V)
|
||||
fctc(sv1);
|
||||
fctc( sv1 );
|
||||
|
||||
vk::ArrayProxyNoTemporaries<int> ap10 = sv0;
|
||||
assert(ap10.size() == 2);
|
||||
// vk::ArrayProxyNoTemporaries<int> ap11 = sv1; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::vector<int,std::allocator<int>>&>(V)
|
||||
assert( ap10.size() == 2 );
|
||||
// vk::ArrayProxyNoTemporaries<int> ap11 = sv1; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const
|
||||
// std::vector<int,std::allocator<int>>&>(V)
|
||||
|
||||
// getVector
|
||||
// fct( getConstVector() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::vector<int,std::allocator<int>>>(V &&)
|
||||
// fctc( getConstVector() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::vector<int,std::allocator<int>>>(V &&)
|
||||
// fct( getVector() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<std::vector<int,std::allocator<int>>>(V &&)
|
||||
// fctc( getVector() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<std::vector<int,std::allocator<int>>>(V &&)
|
||||
// fct( getConstVector() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const
|
||||
// std::vector<int,std::allocator<int>>>(V &&) fctc( getConstVector() ); // not supported: attempting to reference a deleted function:
|
||||
// ArrayProxyNoTemporaries<const std::vector<int,std::allocator<int>>>(V &&) fct( getVector() ); // not supported: attempting to reference a deleted
|
||||
// function: ArrayProxyNoTemporaries<std::vector<int,std::allocator<int>>>(V &&) fctc( getVector() ); // not supported: attempting to reference a
|
||||
// deleted function: ArrayProxyNoTemporaries<std::vector<int,std::allocator<int>>>(V &&)
|
||||
|
||||
vk::ArrayProxyNoTemporaries<const int> ap12 = sv0;
|
||||
assert(ap12.size() == 2);
|
||||
assert( ap12.size() == 2 );
|
||||
vk::ArrayProxyNoTemporaries<const int> ap13 = sv1;
|
||||
assert(ap13.size() == 2);
|
||||
assert( ap13.size() == 2 );
|
||||
|
||||
// std::initializer_list
|
||||
fct({});
|
||||
fctc({});
|
||||
fct( {} );
|
||||
fctc( {} );
|
||||
|
||||
// fct({ 0, 1 }); // not supported: cannot convert argument 1 from 'initializer list' to 'vk::ArrayProxyNoTemporaries<int>'
|
||||
// fctc({ 0, 1 }); // not supported: cannot convert argument 1 from 'initializer list' to 'vk::ArrayProxyNoTemporaries<const int32_t>'
|
||||
@@ -181,55 +183,57 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
// fct({ a, b }); // not supported: cannot convert argument 1 from 'initializer list' to 'vk::ArrayProxyNoTemporaries<int>'
|
||||
// fctc({ a,b }); // not supported: cannot convert argument 1 from 'initializer list' to 'vk::ArrayProxyNoTemporaries<const int32_t>'
|
||||
|
||||
auto il0 = { 0, 1 }; // -> std::initializer_list<int>
|
||||
auto il0 = { 0, 1 }; // -> std::initializer_list<int>
|
||||
// fct(il0); // not supported: cannot convert from 'const int *' to 'int *'
|
||||
fctc(il0);
|
||||
fctc( il0 );
|
||||
|
||||
std::initializer_list<int> il1 = { 0, 1 };
|
||||
// fct(il1); // not supported: cannot convert from 'const int *' to 'int *'
|
||||
fctc(il1);
|
||||
fctc( il1 );
|
||||
|
||||
std::initializer_list<const int> il2 = { 0, 1 };
|
||||
// fct(il2); // not supported: attempting to reference a deleted function : ArrayProxyNoTemporaries<std::initializer_list<T>&>(V)
|
||||
fctc(il2);
|
||||
fctc( il2 );
|
||||
|
||||
std::initializer_list<int> const il3 = { 0, 1 };
|
||||
// fct(il3); // not supported: cannot convert from 'const int *' to 'int *'
|
||||
fctc(il3);
|
||||
fctc( il3 );
|
||||
|
||||
std::initializer_list<const int> const il4 = { 0, 1 };
|
||||
// fct(il4); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::initializer_list<T>&>(V)
|
||||
fctc(il4);
|
||||
fctc( il4 );
|
||||
|
||||
// getInitializerList
|
||||
// fct( getConstInitializerList() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries(const std::initializer_list<int> &&)
|
||||
// fctc( getConstInitializerList() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<T,0>(const std::initializer_list<int> &&)
|
||||
// fct( getInitializerList() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries(std::initializer_list<int> &&)
|
||||
// fctc( getInitializerList() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<T,0>(std::initializer_list<int> &&)
|
||||
// fct( getConstInitializerList() ); // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries(const
|
||||
// std::initializer_list<int> &&) fctc( getConstInitializerList() ); // not supported: attempting to reference a deleted function:
|
||||
// ArrayProxyNoTemporaries<T,0>(const std::initializer_list<int> &&) fct( getInitializerList() ); // not supported: attempting to reference a
|
||||
// deleted function: ArrayProxyNoTemporaries(std::initializer_list<int> &&) fctc( getInitializerList() ); // not supported: attempting to reference
|
||||
// a deleted function: ArrayProxyNoTemporaries<T,0>(std::initializer_list<int> &&)
|
||||
|
||||
// vk::ArrayProxyNoTemporaries<int> ap14 = il1; // not supported: cannot convert from 'const int *' to 'int *'
|
||||
// vk::ArrayProxyNoTemporaries<int> ap15 = il2; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<std::initializer_list<T>&>(V)
|
||||
// vk::ArrayProxyNoTemporaries<int> ap16 = il3; // not supported: cannot convert from 'const int *' to 'int *'
|
||||
// vk::ArrayProxyNoTemporaries<int> ap17 = il4; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const std::initializer_list<T>&>(V)
|
||||
// vk::ArrayProxyNoTemporaries<int> ap15 = il2; // not supported: attempting to reference a deleted function:
|
||||
// ArrayProxyNoTemporaries<std::initializer_list<T>&>(V) vk::ArrayProxyNoTemporaries<int> ap16 = il3; // not supported: cannot convert from 'const int *'
|
||||
// to 'int *' vk::ArrayProxyNoTemporaries<int> ap17 = il4; // not supported: attempting to reference a deleted function: ArrayProxyNoTemporaries<const
|
||||
// std::initializer_list<T>&>(V)
|
||||
|
||||
vk::ArrayProxyNoTemporaries<const int> ap18 = il1;
|
||||
assert(ap18.size() == 2);
|
||||
assert( ap18.size() == 2 );
|
||||
vk::ArrayProxyNoTemporaries<const int> ap19 = il2;
|
||||
assert(ap19.size() == 2);
|
||||
assert( ap19.size() == 2 );
|
||||
vk::ArrayProxyNoTemporaries<const int> ap20 = il3;
|
||||
assert(ap20.size() == 2);
|
||||
assert( ap20.size() == 2 );
|
||||
vk::ArrayProxyNoTemporaries<const int> ap21 = il4;
|
||||
assert(ap21.size() == 2);
|
||||
assert( ap21.size() == 2 );
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -77,9 +77,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
#else
|
||||
|
||||
// aggregate initialization: need to explicitly specify sType and pNext, as well as all the other members !
|
||||
vk::ApplicationInfo ai1{
|
||||
vk::StructureType::eApplicationInfo, nullptr, appName, appVersion, engineName, engineVersion, VK_API_VERSION_1_2
|
||||
};
|
||||
vk::ApplicationInfo ai1{ vk::StructureType::eApplicationInfo, nullptr, appName, appVersion, engineName, engineVersion, VK_API_VERSION_1_2 };
|
||||
|
||||
# if ( 20 <= VULKAN_HPP_CPP_VERSION )
|
||||
// designated initializers are available with C++20
|
||||
|
||||
@@ -46,32 +46,28 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
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;
|
||||
} ) );
|
||||
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(), deviceQueueCreateInfo ) );
|
||||
vk::DeviceQueueCreateInfo deviceQueueCreateInfo( vk::DeviceQueueCreateFlags(), static_cast<uint32_t>( graphicsQueueFamilyIndex ), 1, &queuePriority );
|
||||
vk::UniqueDevice device = physicalDevice.createDeviceUnique( vk::DeviceCreateInfo( vk::DeviceCreateFlags(), deviceQueueCreateInfo ) );
|
||||
|
||||
uint64_t handle = device->getAccelerationStructureHandleNV<uint8_t>( {}, 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( vk::CommandBufferBeginInfo() );
|
||||
|
||||
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() );
|
||||
|
||||
vk::Buffer buffer = device->createBuffer( {} );
|
||||
vk::UniqueBuffer uniqueBuffer = vk::UniqueBuffer( buffer, *device );
|
||||
|
||||
@@ -30,8 +30,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
try
|
||||
{
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
|
||||
|
||||
vk::Instance instance = vk::createInstance( {}, nullptr );
|
||||
|
||||
@@ -26,8 +26,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
try
|
||||
{
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
|
||||
|
||||
vk::Instance instance = vk::createInstance( {}, nullptr );
|
||||
|
||||
@@ -94,12 +94,10 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
auto enabledLayers2 = enabledLayers1;
|
||||
|
||||
vk::ApplicationInfo appInfo( AppName, 1, EngineName, 1, VK_API_VERSION_1_1 );
|
||||
vk::InstanceCreateInfo info1(
|
||||
{}, &appInfo, static_cast<uint32_t>( enabledLayers1.size() ), enabledLayers1.data() );
|
||||
vk::InstanceCreateInfo info2(
|
||||
{}, &appInfo, static_cast<uint32_t>( enabledLayers2.size() ), enabledLayers2.data() );
|
||||
auto h1 = std::hash<vk::InstanceCreateInfo>{}( info1 );
|
||||
auto h2 = std::hash<vk::InstanceCreateInfo>{}( info2 );
|
||||
vk::InstanceCreateInfo info1( {}, &appInfo, static_cast<uint32_t>( enabledLayers1.size() ), enabledLayers1.data() );
|
||||
vk::InstanceCreateInfo info2( {}, &appInfo, static_cast<uint32_t>( enabledLayers2.size() ), enabledLayers2.data() );
|
||||
auto h1 = std::hash<vk::InstanceCreateInfo>{}( info1 );
|
||||
auto h2 = std::hash<vk::InstanceCreateInfo>{}( info2 );
|
||||
assert( h1 == h2 );
|
||||
assert( info1 == info2 );
|
||||
# if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
|
||||
@@ -31,8 +31,7 @@ VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
|
||||
int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
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 );
|
||||
@@ -46,35 +45,26 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
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;
|
||||
} ) );
|
||||
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(), deviceQueueCreateInfo ) )
|
||||
.value;
|
||||
vk::DeviceQueueCreateInfo deviceQueueCreateInfo( vk::DeviceQueueCreateFlags(), static_cast<uint32_t>( graphicsQueueFamilyIndex ), 1, &queuePriority );
|
||||
vk::UniqueDevice device = physicalDevices[0].createDeviceUnique( vk::DeviceCreateInfo( vk::DeviceCreateFlags(), 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;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
try
|
||||
{
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
|
||||
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 );
|
||||
@@ -54,20 +53,14 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
vk::PhysicalDevice physicalDevice = instance->enumeratePhysicalDevices().front();
|
||||
|
||||
// some valid StructureChains
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2> sc0;
|
||||
const vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties> sc1;
|
||||
auto pdp = sc1.get<vk::PhysicalDeviceProperties2>();
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2> sc0;
|
||||
const vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties> sc1;
|
||||
auto pdp = sc1.get<vk::PhysicalDeviceProperties2>();
|
||||
unused( pdp );
|
||||
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::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,
|
||||
@@ -125,14 +118,14 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
unused( a );
|
||||
|
||||
// complex calls, getting StructureChain back
|
||||
auto c = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
auto c = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
vk::PhysicalDeviceFeatures2 & c0 = c.get<vk::PhysicalDeviceFeatures2>();
|
||||
unused( c0 );
|
||||
|
||||
auto t0 = c.get<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
unused( t0 );
|
||||
|
||||
auto d = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
auto d = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
vk::PhysicalDeviceFeatures2 & d0 = d.get<vk::PhysicalDeviceFeatures2>();
|
||||
unused( d0 );
|
||||
vk::PhysicalDeviceVariablePointerFeatures & d1 = d.get<vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
@@ -143,7 +136,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
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 );
|
||||
auto qfd = physicalDevice.getQueueFamilyProperties2<StructureChain, AllocatorType>( VULKAN_HPP_DEFAULT_DISPATCHER );
|
||||
unused( qfd );
|
||||
|
||||
// some tests with structures with allowDuplicate == true
|
||||
|
||||
Reference in New Issue
Block a user