SpiecsEngine
 
Loading...
Searching...
No Matches

◆ TracyGPUContext()

Spices::TracyGPUContext::TracyGPUContext ( VulkanState & state)

Constructor Function.

Parameters
[in]stateVulkanState.

This vector is essential to vkGetCalibratedTimestampsEXT, and only need to be registered once.

Initialize in-scope time stamp info variable.

Push-back timestamp info to timestamps info vector.

timestamps vector.

max deviations vector.

Get calibrated timestamps.

Create Context and set name.

This vector is essential to vkGetCalibratedTimestampsEXT, and only need to be registered once.

Initialize in-scope time stamp info variable.

Push-back timestamp info to timestamps info vector.

timestamps vector.

max deviations vector.

Get calibrated timestamps.

Create Context and set name.

Definition at line 15 of file TracyProfilerWrapper.cpp.

16 : m_VulkanState(state)
17 , m_Context(nullptr)
18 {
20
21 uint32_t count = 0;
22 VK_CHECK(state.m_VkFunc.vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(state.m_PhysicalDevice, &count, nullptr))
23
24 std::vector<VkTimeDomainEXT> timeDomains;
25 timeDomains.resize(count);
26 VK_CHECK(state.m_VkFunc.vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(state.m_PhysicalDevice, &count, timeDomains.data()))
27
28 bool hasDomain = false;
29 if (count > 0)
30 {
34 std::vector<VkCalibratedTimestampInfoEXT> timestampsInfo;
35
36 for (auto& domain : timeDomains)
37 {
41 VkCalibratedTimestampInfoEXT info{};
42 info.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT;
43 info.pNext = nullptr;
44 info.timeDomain = domain;
45
49 timestampsInfo.push_back(info);
50 }
51
55 std::vector<uint64_t> timestamps;
56 timestamps.resize(count);
57
61 std::vector<uint64_t> maxDeviations;
62 maxDeviations.resize(count);
63
67 VK_CHECK(state.m_VkFunc.vkGetCalibratedTimestampsEXT(state.m_Device, timestamps.size(), timestampsInfo.data(), timestamps.data(), maxDeviations.data()))
68
69 std::unordered_map<VkTimeDomainEXT, uint32_t> maps;
70 for (auto& domain : timeDomains)
71 {
72 maps[domain] = 1;
73 }
74
75 hasDomain = maps[VK_TIME_DOMAIN_DEVICE_EXT] && maps[VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT];
76 }
77
78 if (!hasDomain)
79 {
80 std::stringstream ss;
81 ss << "This Device not support VK_TIME_DOMAIN_DEVICE_EXT.";
82
83 SPICES_CORE_ERROR(ss.str());
84 }
85
89#ifdef TRACY_ENABLE
90
91 //m_Context = SPICES_PROFILE_VK_CONTEXHOSTCALIBRATED(state.m_PhysicalDevice, state.m_Device, state.m_VkFunc.vkResetQueryPool, state.m_VkFunc.vkGetPhysicalDeviceCalibrateableTimeDomainsEXT, state.m_VkFunc.vkGetCalibratedTimestampsEXT);
92 //SPICES_PROFILE_VK_CONTEXTNAME(m_Context, "SpicesEngineVulkanContext", 50);
93
94#endif
95
96 }
#define SPICES_PROFILE_ZONE
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
Definition VulkanUtils.h:68
tracy::VkCtx * m_Context
Tracy Vulkan Context.
VulkanState & m_VulkanState
VulkanState.
constexpr int count
Calculate count that meets requirement.
Definition TypeList.h:289
STL namespace.

References m_VulkanState, and TracyGPUContext().

Referenced by TracyGPUContext().