| 234 | //************************************************************************************************ |
| 235 | |
| 236 | RunnableGraph::RunnableGraph( FrameGraph & graph |
| 237 | , GraphNodePtrArray nodes |
| 238 | , RootNode rootNode |
| 239 | , GraphContext & context ) |
| 240 | : m_graph{ graph } |
| 241 | , m_context{ context } |
| 242 | , m_resources{ m_graph.getHandler(), m_context } |
| 243 | , m_nodes{ std::move( nodes ) } |
| 244 | , m_rootNode{ std::move( rootNode ) } |
| 245 | , m_timerQueries{ m_context |
| 246 | , createQueryPool( m_context, m_graph.getName() + "TimerQueries", uint32_t( ( m_nodes.size() + 1u ) * 2u * 2u ) ) |
| 247 | , []( GraphContext & ctx, VkQueryPool & object )noexcept |
| 248 | { |
| 249 | crgUnregisterObject( ctx, object ); |
| 250 | ctx.vkDestroyQueryPool( ctx.device, object, ctx.allocator ); |
| 251 | object = {}; |
| 252 | } } |
| 253 | , m_commandPool{ m_context |
| 254 | , rungrf::createCommandPool( m_context, m_graph.getName() ) |
| 255 | , []( GraphContext & ctx, VkCommandPool & object )noexcept |
| 256 | { |
| 257 | crgUnregisterObject( ctx, object ); |
| 258 | ctx.vkDestroyCommandPool( ctx.device, object, ctx.allocator ); |
| 259 | object = {}; |
| 260 | } } |
| 261 | , m_fence{ m_context |
| 262 | , graph.getName() + "/Graph" |
| 263 | , { VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, nullptr, VK_FENCE_CREATE_SIGNALED_BIT } } |
| 264 | , m_timer{ context, graph.getName() + "/Graph", TimerScope::eGraph, getTimerQueryPool(), getTimerQueryOffset() } |
| 265 | { |
| 266 | auto name = m_graph.getName() + "/Graph"; |
| 267 | |
| 268 | if ( m_context.vkCreateSemaphore ) |
| 269 | { |
| 270 | VkSemaphoreCreateInfo createInfo{ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO |
| 271 | , nullptr |
| 272 | , 0u }; |
| 273 | auto res = context.vkCreateSemaphore( m_context.device |
| 274 | , &createInfo |
| 275 | , m_context.allocator |
| 276 | , &m_semaphore ); |
| 277 | checkVkResult( res, name + " - Semaphore creation" ); |
| 278 | crgRegisterObject( m_context, name, m_semaphore ); |
| 279 | } |
| 280 | |
| 281 | if ( m_context.vkAllocateCommandBuffers ) |
| 282 | { |
| 283 | VkCommandBufferAllocateInfo allocateInfo{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO |
| 284 | , nullptr |
| 285 | , getCommandPool() |
| 286 | , VK_COMMAND_BUFFER_LEVEL_PRIMARY |
| 287 | , 1u }; |
| 288 | auto res = m_context.vkAllocateCommandBuffers( m_context.device |
| 289 | , &allocateInfo |
| 290 | , &m_commandBuffer ); |
| 291 | checkVkResult( res, name + " - CommandBuffer allocation" ); |
| 292 | crgRegisterObject( m_context, name, m_commandBuffer ); |
| 293 |
nothing calls this directly
no test coverage detected