Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
gpu_tracer_gles.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_GPU_TRACER_GLES_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_GPU_TRACER_GLES_H_
7
8#include <cstdint>
9#include <deque>
10#include <thread>
11
13
14namespace impeller {
15
16/// @brief Trace GPU execution times using GL_EXT_disjoint_timer_query on GLES.
17///
18/// Note: there are a substantial number of GPUs where usage of the this API is
19/// known to cause crashes. As a result, this functionality is disabled by
20/// default and can only be enabled in debug/profile mode via a specific opt-in
21/// flag that is exposed in the Android manifest.
22///
23/// To enable, add the following metadata to the application's Android manifest:
24/// <meta-data
25/// android:name="io.flutter.embedding.android.EnableOpenGLGPUTracing"
26/// android:value="false" />
28 public:
29 GPUTracerGLES(const ProcTableGLES& gl, bool enable_tracing);
30
31 ~GPUTracerGLES() = default;
32
33 /// @brief Reset query tracking. Must be called when reusing reusing GLES
34 /// context in a new window (e.g. for playground tests).
35 void Reset();
36
37 /// @brief Record the thread id of the raster thread.
38 void RecordRasterThread();
39
40 /// @brief Record the start of a frame workload, if one hasn't already been
41 /// started.
42 void MarkFrameStart(const ProcTableGLES& gl);
43
44 /// @brief Record the end of a frame workload.
45 void MarkFrameEnd(const ProcTableGLES& gl);
46
47 private:
48 void ProcessQueries(const ProcTableGLES& gl);
49
50 std::deque<uint32_t> pending_traces_;
51 std::optional<uint32_t> active_frame_ = std::nullopt;
52 std::thread::id raster_thread_;
53
54 bool enabled_ = false;
55};
56
57} // namespace impeller
58
59#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_GPU_TRACER_GLES_H_
Trace GPU execution times using GL_EXT_disjoint_timer_query on GLES.
void MarkFrameEnd(const ProcTableGLES &gl)
Record the end of a frame workload.
void MarkFrameStart(const ProcTableGLES &gl)
Record the start of a frame workload, if one hasn't already been started.
void RecordRasterThread()
Record the thread id of the raster thread.
void Reset()
Reset query tracking. Must be called when reusing reusing GLES context in a new window (e....