Add pNext as optional last argument to constructors of structs that hold a pNext.

This commit is contained in:
asuessenbach
2022-03-23 17:08:19 +01:00
parent efcb07a591
commit d90c6cbbfc
7 changed files with 3307 additions and 1744 deletions

View File

@@ -52,7 +52,7 @@ int main( int /*argc*/, char ** /*argv*/ )
<< "subsetAllocation = " << !!groupProperties[i].subsetAllocation << "\n";
std::cout << "\n";
if ( 1 < groupProperties[i].physicalDeviceCount )
if ( 0 < groupProperties[i].physicalDeviceCount )
{
vk::PhysicalDevice physicalDevice = groupProperties[i].physicalDevices[0];
@@ -69,12 +69,10 @@ int main( int /*argc*/, char ** /*argv*/ )
// create a Device
float queuePriority = 0.0f;
vk::DeviceQueueCreateInfo deviceQueueCreateInfo( vk::DeviceQueueCreateFlags(), static_cast<uint32_t>( graphicsQueueFamilyIndex ), 1, &queuePriority );
vk::DeviceCreateInfo deviceCreateInfo( vk::DeviceCreateFlags(), deviceQueueCreateInfo );
vk::StructureChain<vk::DeviceCreateInfo, vk::DeviceGroupDeviceCreateInfo> deviceCreateInfoChain(
{ {}, deviceQueueCreateInfo }, { groupProperties[i].physicalDeviceCount, groupProperties[i].physicalDevices } );
vk::DeviceGroupDeviceCreateInfo deviceGroupDeviceCreateInfo( groupProperties[i].physicalDeviceCount, groupProperties[i].physicalDevices );
deviceCreateInfo.pNext = &deviceGroupDeviceCreateInfo;
vk::Device device = physicalDevice.createDevice( deviceCreateInfo );
vk::Device device = physicalDevice.createDevice( deviceCreateInfoChain.get<vk::DeviceCreateInfo>() );
// ... and destroy it again
device.destroy();

View File

@@ -63,10 +63,10 @@ struct GeometryInstanceData
}
float transform[12]; // Transform matrix, containing only the top 3 rows
uint32_t instanceId : 24; // Instance index
uint32_t mask : 8; // Visibility mask
uint32_t instanceId : 24; // Instance index
uint32_t mask : 8; // Visibility mask
uint32_t instanceOffset : 24; // Index of the hit group which will be invoked when a ray hits the instance
uint32_t flags : 8; // Instance flags, such as culling
uint32_t flags : 8; // Instance flags, such as culling
uint64_t accelerationStructureHandle; // Opaque handle of the bottom-level acceleration structure
};
static_assert( sizeof( GeometryInstanceData ) == 64, "GeometryInstanceData structure compiles to incorrect size" );
@@ -961,8 +961,8 @@ int main( int /*argc*/, char ** /*argv*/ )
std::vector<vk::WriteDescriptorSet> accelerationDescriptionSets;
for ( size_t i = 0; i < rayTracingDescriptorSets.size(); i++ )
{
accelerationDescriptionSets.emplace_back( rayTracingDescriptorSets[i], 0, 0, 1, bindings[0].descriptorType );
accelerationDescriptionSets.back().pNext = &writeDescriptorSetAcceleration;
accelerationDescriptionSets.emplace_back(
rayTracingDescriptorSets[i], 0, 0, 1, bindings[0].descriptorType, nullptr, nullptr, nullptr, &writeDescriptorSetAcceleration );
}
device.updateDescriptorSets( accelerationDescriptionSets, nullptr );

View File

@@ -106,8 +106,7 @@ namespace vk
float queuePriority = 0.0f;
vk::DeviceQueueCreateInfo deviceQueueCreateInfo( {}, queueFamilyIndex, 1, &queuePriority );
vk::DeviceCreateInfo deviceCreateInfo( {}, deviceQueueCreateInfo, {}, enabledExtensions, physicalDeviceFeatures );
deviceCreateInfo.pNext = pNext;
vk::DeviceCreateInfo deviceCreateInfo( {}, deviceQueueCreateInfo, {}, enabledExtensions, physicalDeviceFeatures, pNext );
vk::Device device = physicalDevice.createDevice( deviceCreateInfo );
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
@@ -768,7 +767,8 @@ namespace vk
vk::ImageLayout::eUndefined,
vk::MemoryPropertyFlagBits::eDeviceLocal,
vk::ImageAspectFlagBits::eDepth )
{}
{
}
ImageData::ImageData( vk::PhysicalDevice const & physicalDevice,
vk::Device const & device,
@@ -839,8 +839,8 @@ namespace vk
swapchainExtent = surfaceCapabilities.currentExtent;
}
vk::SurfaceTransformFlagBitsKHR preTransform = ( surfaceCapabilities.supportedTransforms & vk::SurfaceTransformFlagBitsKHR::eIdentity )
? vk::SurfaceTransformFlagBitsKHR::eIdentity
: surfaceCapabilities.currentTransform;
? vk::SurfaceTransformFlagBitsKHR::eIdentity
: surfaceCapabilities.currentTransform;
vk::CompositeAlphaFlagBitsKHR compositeAlpha =
( surfaceCapabilities.supportedCompositeAlpha & vk::CompositeAlphaFlagBitsKHR::ePreMultiplied ) ? vk::CompositeAlphaFlagBitsKHR::ePreMultiplied
: ( surfaceCapabilities.supportedCompositeAlpha & vk::CompositeAlphaFlagBitsKHR::ePostMultiplied ) ? vk::CompositeAlphaFlagBitsKHR::ePostMultiplied
@@ -887,7 +887,8 @@ namespace vk
CheckerboardImageGenerator::CheckerboardImageGenerator( std::array<uint8_t, 3> const & rgb0, std::array<uint8_t, 3> const & rgb1 )
: m_rgb0( rgb0 ), m_rgb1( rgb1 )
{}
{
}
void CheckerboardImageGenerator::operator()( void * data, vk::Extent2D & extent ) const
{