[Impeller] Clear the GPUTracerVK in_frame flag when ending a frame even if the tracer is disabled (flutter/engine#50228)
Without this an assertion in GPUTracerVK::MarkFrameStart will fail on the next frame.
This commit is contained in:
@@ -85,6 +85,8 @@ void GPUTracerVK::MarkFrameStart() {
|
||||
}
|
||||
|
||||
void GPUTracerVK::MarkFrameEnd() {
|
||||
in_frame_ = false;
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
@@ -101,7 +103,6 @@ void GPUTracerVK::MarkFrameEnd() {
|
||||
FML_DCHECK(state.pending_buffers == 0u);
|
||||
state.pending_buffers = 0;
|
||||
state.current_index = 0;
|
||||
in_frame_ = false;
|
||||
}
|
||||
|
||||
std::unique_ptr<GPUProbe> GPUTracerVK::CreateGPUProbe() {
|
||||
|
||||
@@ -27,6 +27,22 @@ TEST(GPUTracerVK, CanBeDisabled) {
|
||||
ASSERT_FALSE(tracer->IsEnabled());
|
||||
}
|
||||
|
||||
TEST(GPUTracerVK, DisabledFrameCycle) {
|
||||
auto const context =
|
||||
MockVulkanContextBuilder()
|
||||
.SetSettingsCallback([](ContextVK::Settings& settings) {
|
||||
settings.enable_gpu_tracing = false;
|
||||
})
|
||||
.Build();
|
||||
auto tracer = context->GetGPUTracer();
|
||||
|
||||
// Check that a repeated frame start/end cycle does not fail any assertions.
|
||||
for (int i = 0; i < 2; i++) {
|
||||
tracer->MarkFrameStart();
|
||||
tracer->MarkFrameEnd();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(GPUTracerVK, CanTraceCmdBuffer) {
|
||||
auto const context =
|
||||
MockVulkanContextBuilder()
|
||||
|
||||
Reference in New Issue
Block a user