Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 68943af

Browse files
[Impeller] Clear the GPUTracerVK in_frame flag when ending a frame even if the tracer is disabled (#50228)
Without this an assertion in GPUTracerVK::MarkFrameStart will fail on the next frame.
1 parent bbdbc3a commit 68943af

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

impeller/renderer/backend/vulkan/gpu_tracer_vk.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ void GPUTracerVK::MarkFrameStart() {
8585
}
8686

8787
void GPUTracerVK::MarkFrameEnd() {
88+
in_frame_ = false;
89+
8890
if (!enabled_) {
8991
return;
9092
}
@@ -101,7 +103,6 @@ void GPUTracerVK::MarkFrameEnd() {
101103
FML_DCHECK(state.pending_buffers == 0u);
102104
state.pending_buffers = 0;
103105
state.current_index = 0;
104-
in_frame_ = false;
105106
}
106107

107108
std::unique_ptr<GPUProbe> GPUTracerVK::CreateGPUProbe() {

impeller/renderer/backend/vulkan/test/gpu_tracer_unittests.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ TEST(GPUTracerVK, CanBeDisabled) {
2727
ASSERT_FALSE(tracer->IsEnabled());
2828
}
2929

30+
TEST(GPUTracerVK, DisabledFrameCycle) {
31+
auto const context =
32+
MockVulkanContextBuilder()
33+
.SetSettingsCallback([](ContextVK::Settings& settings) {
34+
settings.enable_gpu_tracing = false;
35+
})
36+
.Build();
37+
auto tracer = context->GetGPUTracer();
38+
39+
// Check that a repeated frame start/end cycle does not fail any assertions.
40+
for (int i = 0; i < 2; i++) {
41+
tracer->MarkFrameStart();
42+
tracer->MarkFrameEnd();
43+
}
44+
}
45+
3046
TEST(GPUTracerVK, CanTraceCmdBuffer) {
3147
auto const context =
3248
MockVulkanContextBuilder()

0 commit comments

Comments
 (0)