tracy: guards for missing vk profiler context
This commit is contained in:
parent
955752a24b
commit
64569ff737
|
@ -272,8 +272,9 @@ void RendererVulkan::Present(Frame* frame) {
|
|||
const vk::CommandBuffer cmdbuf = frame->cmdbuf;
|
||||
cmdbuf.begin(begin_info);
|
||||
{
|
||||
TracyVkZoneC(instance.GetProfilerContext(), cmdbuf, "Host frame",
|
||||
MarkersPallete::GpuMarkerColor);
|
||||
auto* profiler_ctx = instance.GetProfilerContext();
|
||||
TracyVkNamedZoneC(profiler_ctx, renderer_gpu_zone, cmdbuf, "Host frame",
|
||||
MarkersPallete::GpuMarkerColor, profiler_ctx != nullptr);
|
||||
|
||||
const vk::Extent2D extent = swapchain.GetExtent();
|
||||
const std::array pre_barriers{
|
||||
|
@ -339,8 +340,11 @@ void RendererVulkan::Present(Frame* frame) {
|
|||
cmdbuf.pipelineBarrier(vk::PipelineStageFlagBits::eAllCommands,
|
||||
vk::PipelineStageFlagBits::eAllCommands,
|
||||
vk::DependencyFlagBits::eByRegion, {}, {}, post_barrier);
|
||||
|
||||
if (profiler_ctx) {
|
||||
TracyVkCollect(profiler_ctx, cmdbuf);
|
||||
}
|
||||
}
|
||||
TracyVkCollect(instance.GetProfilerContext(), cmdbuf);
|
||||
cmdbuf.end();
|
||||
|
||||
static constexpr std::array<vk::PipelineStageFlags, 2> wait_stage_masks = {
|
||||
|
|
|
@ -46,16 +46,22 @@ void Scheduler::AllocateWorkerCommandBuffers() {
|
|||
current_cmdbuf = command_pool.Commit();
|
||||
current_cmdbuf.begin(begin_info);
|
||||
|
||||
static const auto scope_loc = GPU_SCOPE_LOCATION("Guest Frame", MarkersPallete::GpuMarkerColor);
|
||||
new (profiler_scope)
|
||||
tracy::VkCtxScope{instance.GetProfilerContext(), &scope_loc, current_cmdbuf, true};
|
||||
auto* profiler_ctx = instance.GetProfilerContext();
|
||||
if (profiler_ctx) {
|
||||
static const auto scope_loc =
|
||||
GPU_SCOPE_LOCATION("Guest Frame", MarkersPallete::GpuMarkerColor);
|
||||
new (profiler_scope) tracy::VkCtxScope{profiler_ctx, &scope_loc, current_cmdbuf, true};
|
||||
}
|
||||
}
|
||||
|
||||
void Scheduler::SubmitExecution(vk::Semaphore signal_semaphore, vk::Semaphore wait_semaphore) {
|
||||
const u64 signal_value = master_semaphore.NextTick();
|
||||
|
||||
auto* profiler_ctx = instance.GetProfilerContext();
|
||||
if (profiler_ctx) {
|
||||
profiler_scope->~VkCtxScope();
|
||||
TracyVkCollect(instance.GetProfilerContext(), current_cmdbuf);
|
||||
TracyVkCollect(profiler_ctx, current_cmdbuf);
|
||||
}
|
||||
|
||||
std::scoped_lock lk{submit_mutex};
|
||||
master_semaphore.SubmitWork(current_cmdbuf, wait_semaphore, signal_semaphore, signal_value);
|
||||
|
|
Loading…
Reference in New Issue