MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ resolve_timestamp()

ShaderFoundry::TimestampResult MayaFlux::Portal::Graphics::ShaderFoundry::resolve_timestamp ( const CommandBufferState &  state,
const std::string &  label,
bool  wait 
)
private

Definition at line 1452 of file ShaderFoundry.cpp.

1453{
1454 auto query_it = state.timestamp_queries.find(label);
1455 if (query_it == state.timestamp_queries.end() || !state.timestamp_pool) {
1456 return { .label = label, .duration_ns = 0, .valid = false };
1457 }
1458
1459 uint32_t query_index = query_it->second;
1460 uint64_t timestamps[2];
1461
1462 vk::QueryResultFlags flags = vk::QueryResultFlagBits::e64;
1463 if (wait) {
1464 flags |= vk::QueryResultFlagBits::eWait;
1465 }
1466
1467 auto result = get_device().getQueryPoolResults(
1468 state.timestamp_pool,
1469 query_index,
1470 2,
1471 sizeof(timestamps),
1472 timestamps,
1473 sizeof(uint64_t),
1474 flags);
1475
1476 if (result != vk::Result::eSuccess) {
1477 return { .label = label, .duration_ns = 0, .valid = false };
1478 }
1479
1480 auto props = m_backend->get_context().get_physical_device().getProperties();
1481 float timestamp_period = props.limits.timestampPeriod;
1482
1483 auto duration_ns = static_cast<uint64_t>((timestamps[1] - timestamps[0]) * timestamp_period);
1484
1485 return { .label = label, .duration_ns = duration_ns, .valid = true };
1486}
uint32_t label
Definition Contours.cpp:16
vk::Device get_device() const
Get logical device handle.
std::shared_ptr< Core::VulkanBackend > m_backend

References get_device(), label, m_backend, MayaFlux::Portal::Graphics::ShaderFoundry::CommandBufferState::timestamp_pool, and MayaFlux::Portal::Graphics::ShaderFoundry::CommandBufferState::timestamp_queries.

Referenced by get_timestamp_result(), and submit_and_wait().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: