Introduce function release() to all vk::raii::HandleTypes.

This commit is contained in:
asuessenbach
2022-10-25 12:11:29 +02:00
parent ec9ee4ff04
commit d5ad2e1883
4 changed files with 392 additions and 8 deletions

View File

@@ -174,11 +174,13 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::DeviceCreateInfo deviceCreateInfo( {}, deviceQueueCreateInfo );
vk::raii::Device device( physicalDevice, deviceCreateInfo );
// Create a vk::CommandPool (not a vk::raii::CommandPool, for testing purposes!)
vk::CommandPoolCreateInfo commandPoolCreateInfo( {}, graphicsQueueFamilyIndex );
vk::CommandPool commandPool = ( *device ).createCommandPool( commandPoolCreateInfo, nullptr, *device.getDispatcher() );
vk::raii::CommandPool commandPool( device, commandPoolCreateInfo );
// The commandPool is not destroyed automatically (as it's not a UniqueCommandPool.
// release the CommandPool without destroying it (for testing purposes only!)
vk::CommandPool cp = commandPool.release();
// The commandPool is not destroyed automatically (as it's released from its handle)
// That is, the device is destroyed before the commmand pool and will trigger a validation error.
std::cout << "*** INTENTIONALLY destroying the Device before destroying a CommandPool ***\n";
std::cout << "*** The following error message is EXPECTED ***\n";