| 40 | } |
| 41 | |
| 42 | int main() |
| 43 | { |
| 44 | try |
| 45 | { |
| 46 | vk::ApplicationInfo appInfo( AppName, 1, EngineName, 1, vk::ApiVersion11 ); |
| 47 | vk::UniqueInstance instance = vk::createInstanceUnique( vk::InstanceCreateInfo( {}, &appInfo ) ); |
| 48 | vk::PhysicalDevice physicalDevice = instance->enumeratePhysicalDevices().front(); |
| 49 | |
| 50 | uint32_t propertyCount; |
| 51 | physicalDevice.getQueueFamilyProperties( &propertyCount, nullptr ); |
| 52 | |
| 53 | // get the QueueFamilyProperties of the first PhysicalDevice |
| 54 | std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties(); |
| 55 | |
| 56 | // get the first index into queueFamiliyProperties which supports graphics |
| 57 | std::size_t graphicsQueueFamilyIndex = |
| 58 | std::distance( queueFamilyProperties.begin(), |
| 59 | std::find_if( queueFamilyProperties.begin(), |
| 60 | queueFamilyProperties.end(), |
| 61 | []( vk::QueueFamilyProperties const & qfp ) { return qfp.queueFlags & vk::QueueFlagBits::eGraphics; } ) ); |
| 62 | release_assert( graphicsQueueFamilyIndex < queueFamilyProperties.size() ); |
| 63 | |
| 64 | // create a UniqueDevice |
| 65 | float queuePriority = 0.0f; |
| 66 | vk::DeviceQueueCreateInfo deviceQueueCreateInfo( vk::DeviceQueueCreateFlags(), static_cast<uint32_t>( graphicsQueueFamilyIndex ), 1, &queuePriority ); |
| 67 | vk::UniqueDevice device = physicalDevice.createDeviceUnique( vk::DeviceCreateInfo( vk::DeviceCreateFlags(), deviceQueueCreateInfo ) ); |
| 68 | |
| 69 | uint64_t handle = device->getAccelerationStructureHandleNV<uint8_t>( {}, VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE() ); |
| 70 | |
| 71 | std::vector<vk::UniqueCommandBuffer>::allocator_type vectorAllocator; |
| 72 | vk::UniqueCommandBuffer commandBuffer = |
| 73 | std::move( device->allocateCommandBuffersUnique( {}, vectorAllocator, VULKAN_HPP_DISPATCH_LOADER_STATIC_TYPE() ).front() ); |
| 74 | |
| 75 | std::vector<vk::UniqueCommandBuffer> uniqueCommandBuffers; |
| 76 | uniqueCommandBuffers = createCommandBuffers( device.get(), {}, uniqueCommandBuffers.get_allocator(), VULKAN_HPP_DISPATCH_LOADER_STATIC_TYPE() ); |
| 77 | commandBuffer = std::move( uniqueCommandBuffers.front() ); |
| 78 | |
| 79 | commandBuffer->begin( vk::CommandBufferBeginInfo() ); |
| 80 | |
| 81 | std::vector<vk::UniqueHandle<vk::CommandBuffer, VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE>>::allocator_type dynamicVectorAllocator; |
| 82 | vk::UniqueHandle<vk::CommandBuffer, VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE> dynamicCommandBuffer = |
| 83 | std::move( device->allocateCommandBuffersUnique( {}, dynamicVectorAllocator, VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE() ).front() ); |
| 84 | |
| 85 | std::vector<vk::UniqueHandle<vk::CommandBuffer, VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE>> dynamicUniqueCommandBuffers; |
| 86 | dynamicUniqueCommandBuffers = |
| 87 | createCommandBuffers( device.get(), {}, dynamicUniqueCommandBuffers.get_allocator(), VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE() ); |
| 88 | dynamicCommandBuffer = std::move( dynamicUniqueCommandBuffers.front() ); |
| 89 | |
| 90 | vk::Buffer buffer = device->createBuffer( {} ); |
| 91 | vk::UniqueBuffer uniqueBuffer = vk::UniqueBuffer( buffer, *device ); |
| 92 | |
| 93 | vk::DeviceMemory deviceMemory = device->allocateMemory( {} ); |
| 94 | vk::UniqueDeviceMemory uniqueDeviceMemory = vk::UniqueDeviceMemory( deviceMemory, *device ); |
| 95 | |
| 96 | vk::ResultValue<std::vector<vk::UniquePipeline>> pipelines = device->createGraphicsPipelinesUnique( nullptr, {} ); |
| 97 | } |
| 98 | catch ( vk::SystemError const & err ) |
| 99 | { |
nothing calls this directly
no test coverage detected