mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Add pNext as optional last argument to constructors of structs that hold a pNext.
This commit is contained in:
parent
efcb07a591
commit
d90c6cbbfc
@ -65,10 +65,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" );
|
||||
@ -174,7 +174,8 @@ struct PerFrameData
|
||||
, fence( device, vk::FenceCreateInfo( vk::FenceCreateFlagBits::eSignaled ) )
|
||||
, presentCompleteSemaphore( device, vk::SemaphoreCreateInfo() )
|
||||
, renderCompleteSemaphore( device, vk::SemaphoreCreateInfo() )
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
vk::raii::CommandPool commandPool;
|
||||
vk::raii::CommandBuffer commandBuffer;
|
||||
@ -962,8 +963,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 );
|
||||
|
||||
@ -1102,7 +1103,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
&swapChainData.swapChain,
|
||||
graphicsAndPresentQueueFamilyIndex.first,
|
||||
graphicsAndPresentQueueFamilyIndex.second );
|
||||
depthBufferData = vk::raii::su::DepthBufferData( physicalDevice, device, vk::su::pickDepthFormat( *physicalDevice ), windowExtent );
|
||||
depthBufferData = vk::raii::su::DepthBufferData( physicalDevice, device, vk::raii::su::pickDepthFormat( physicalDevice ), windowExtent );
|
||||
|
||||
vk::raii::su::oneTimeSubmit(
|
||||
commandBuffer,
|
||||
|
@ -308,7 +308,8 @@ namespace vk
|
||||
vk::ImageLayout::eUndefined,
|
||||
vk::MemoryPropertyFlagBits::eDeviceLocal,
|
||||
vk::ImageAspectFlagBits::eDepth )
|
||||
{}
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct SurfaceData
|
||||
@ -356,8 +357,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
|
||||
@ -591,8 +592,7 @@ namespace vk
|
||||
|
||||
float queuePriority = 0.0f;
|
||||
vk::DeviceQueueCreateInfo deviceQueueCreateInfo( vk::DeviceQueueCreateFlags(), queueFamilyIndex, 1, &queuePriority );
|
||||
vk::DeviceCreateInfo deviceCreateInfo( vk::DeviceCreateFlags(), deviceQueueCreateInfo, {}, enabledExtensions, physicalDeviceFeatures );
|
||||
deviceCreateInfo.pNext = pNext;
|
||||
vk::DeviceCreateInfo deviceCreateInfo( vk::DeviceCreateFlags(), deviceQueueCreateInfo, {}, enabledExtensions, physicalDeviceFeatures, pNext );
|
||||
return vk::raii::Device( physicalDevice, deviceCreateInfo );
|
||||
}
|
||||
|
||||
|
@ -10278,13 +10278,19 @@ std::string VulkanHppGenerator::generateStructConstructors( std::pair<std::strin
|
||||
arguments += argument;
|
||||
}
|
||||
|
||||
// gather the initializers; skip member 'pNext' and members with exactly one legal value
|
||||
if ( ( member.name != "pNext" ) && member.value.empty() )
|
||||
// gather the initializers; skip members with exactly one legal value
|
||||
if ( member.value.empty() )
|
||||
{
|
||||
initializers += ( firstArgument ? ":" : "," ) + std::string( " " ) + member.name + "( " + member.name + "_ )";
|
||||
initializers += std::string( firstArgument ? ": " : ", " ) + member.name + "( " + member.name + "_ )";
|
||||
firstArgument = false;
|
||||
}
|
||||
}
|
||||
auto pNextIt = std::find_if( structData.second.members.begin(), structData.second.members.end(), []( MemberData const & md ) { return md.name == "pNext"; } );
|
||||
if ( pNextIt != structData.second.members.end() )
|
||||
{
|
||||
// add pNext as a last optional argument to the constructor
|
||||
arguments += std::string( listedArgument ? ", " : "" ) + pNextIt->type.compose( "VULKAN_HPP_NAMESPACE" ) + " pNext_ = nullptr";
|
||||
}
|
||||
|
||||
std::string str = replaceWithMap( constructors,
|
||||
{ { "arguments", arguments },
|
||||
@ -10323,8 +10329,13 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced( std::pair<st
|
||||
std::string templateHeader, sizeChecks;
|
||||
for ( auto mit = structData.second.members.begin(); mit != structData.second.members.end(); ++mit )
|
||||
{
|
||||
// gather the initializers; skip member 'pNext' and constant members
|
||||
if ( ( mit->name != "pNext" ) && mit->value.empty() )
|
||||
// gather the initializers
|
||||
if ( mit->name == "pNext" ) // for pNext, we just get the initializer... the argument is added at the end
|
||||
{
|
||||
initializers += std::string( firstArgument ? ":" : "," ) + " pNext( pNext_ )";
|
||||
firstArgument = false;
|
||||
}
|
||||
else if ( mit->value.empty() ) // skip constant members
|
||||
{
|
||||
auto litit = lenIts.find( mit );
|
||||
if ( litit != lenIts.end() )
|
||||
@ -10376,6 +10387,15 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced( std::pair<st
|
||||
firstArgument = false;
|
||||
}
|
||||
}
|
||||
|
||||
auto pNextIt =
|
||||
std::find_if( structData.second.members.begin(), structData.second.members.end(), []( MemberData const & md ) { return md.name == "pNext"; } );
|
||||
if ( pNextIt != structData.second.members.end() )
|
||||
{
|
||||
// add pNext as a last optional argument to the constructor
|
||||
arguments += std::string( listedArgument ? ", " : "" ) + pNextIt->type.compose( "VULKAN_HPP_NAMESPACE" ) + " pNext_ = nullptr";
|
||||
}
|
||||
|
||||
static const std::string constructorTemplate = R"(
|
||||
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
${templateHeader} ${structName}( ${arguments} )
|
||||
|
@ -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();
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user