Refactor RAII-samples to use std::unique_ptr only if needed.

This commit is contained in:
asuessenbach
2021-06-21 11:32:43 +02:00
parent da2ecae452
commit 69e8e5bf84
52 changed files with 2171 additions and 2437 deletions

View File

@@ -15,8 +15,9 @@
// VulkanHpp Samples : 01_InitInstanceRAII
// Create and destroy a vk::UniqueInstance
#include "vulkan/vulkan_raii.hpp"
#include "../utils/utils.hpp"
#include "vulkan/vulkan_raii.hpp"
#include <iostream>
static std::string AppName = "01_InitInstanceRAII";
@@ -29,7 +30,7 @@ int main( int /*argc*/, char ** /*argv*/ )
try
{
// the very beginning: instantiate a context
std::unique_ptr<vk::raii::Context> context = vk::raii::su::make_unique<vk::raii::Context>();
vk::raii::Context context;
// initialize the vk::ApplicationInfo structure
vk::ApplicationInfo applicationInfo( AppName.c_str(), 1, EngineName.c_str(), 1, VK_API_VERSION_1_1 );
@@ -38,7 +39,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::InstanceCreateInfo instanceCreateInfo( {}, &applicationInfo );
// create an Instance
std::unique_ptr<vk::raii::Instance> instance = vk::raii::su::make_unique<vk::raii::Instance>( *context, instanceCreateInfo );
vk::raii::Instance instance( context, instanceCreateInfo );
}
catch ( vk::SystemError & err )
{