[Impeller] Invoke glDebugMessageControl before glPushDebugGroup (flutter/engine#46392)
Closes https://github.com/flutter/flutter/issues/135715. I plan to add tests before submitting once https://github.com/flutter/engine/pull/46433 lands, probably something around `glDebugMessageControl` being emitted once per context, since that's what we need to keep working for Pixel phones. ## Output <details> <summary>Screenshot of app running locally, showing lack of off-screen MSAA</summary>  </details> ```shell $ fl run --enable-impeller --local-engine=$ENGINE/out/android_debug_unopt_arm64 --local-engine-host=$ENGINE/out/host_debug_unopt_arm64 Launching lib/main.dart on Pixel 5 in debug mode... Running Gradle task 'assembleDebug'... 33.7s ✓ Built build/app/outputs/flutter-apk/app-debug.apk. Installing build/app/outputs/flutter-apk/app-debug.apk... 17.8s E/flutter (17749): [ERROR:flutter/shell/platform/android/android_context_gl_impeller.cc(80)] Using the Impeller rendering backend (OpenGLES). Syncing files to device Pixel 5... 70ms Flutter run key commands. r Hot reload. 🔥🔥🔥 R Hot restart. h List all available interactive commands. d Detach (terminate "flutter run" but leave application running). c Clear the screen q Quit (terminate the application on the device). A Dart VM Service on Pixel 5 is available at: http://127.0.0.1:57181/CrsakIgCHFY=/ I/cle_opacity_foo(17749): Compiler allocated 4413KB to compile void android.view.ViewRootImpl.performTraversals() The Flutter DevTools debugger and profiler on Pixel 5 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:57181/CrsakIgCHFY=/ ```
This commit is contained in:
@@ -4,19 +4,13 @@
|
||||
|
||||
#include "impeller/renderer/backend/gles/blit_pass_gles.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "impeller/base/config.h"
|
||||
#include "impeller/base/validation.h"
|
||||
#include "fml/closure.h"
|
||||
#include "impeller/core/formats.h"
|
||||
#include "impeller/renderer/backend/gles/blit_command_gles.h"
|
||||
#include "impeller/renderer/backend/gles/device_buffer_gles.h"
|
||||
#include "impeller/renderer/backend/gles/formats_gles.h"
|
||||
#include "impeller/renderer/backend/gles/pipeline_gles.h"
|
||||
#include "impeller/renderer/backend/gles/proc_table_gles.h"
|
||||
#include "impeller/renderer/backend/gles/texture_gles.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class ProcTableGLES;
|
||||
|
||||
class DescriptionGLES {
|
||||
public:
|
||||
DescriptionGLES(const ProcTableGLES& gl);
|
||||
explicit DescriptionGLES(const ProcTableGLES& gl);
|
||||
|
||||
~DescriptionGLES();
|
||||
|
||||
@@ -28,6 +28,7 @@ class DescriptionGLES {
|
||||
|
||||
bool HasExtension(const std::string& ext) const;
|
||||
|
||||
/// @brief Returns whether GLES includes the debug extension.
|
||||
bool HasDebugExtension() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "flutter/fml/container.h"
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "fml/closure.h"
|
||||
#include "impeller/base/promise.h"
|
||||
#include "impeller/renderer/backend/gles/pipeline_gles.h"
|
||||
#include "impeller/renderer/backend/gles/shader_function_gles.h"
|
||||
|
||||
@@ -322,6 +322,7 @@ void ProcTableGLES::PushDebugGroup(const std::string& label) const {
|
||||
if (debug_label_max_length_ <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
UniqueID id;
|
||||
const auto label_length =
|
||||
std::min<GLsizei>(debug_label_max_length_ - 1, label.size());
|
||||
@@ -336,6 +337,7 @@ void ProcTableGLES::PopDebugGroup() const {
|
||||
if (debug_label_max_length_ <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
PopDebugGroupKHR();
|
||||
}
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@ struct GLProc {
|
||||
#define FOR_EACH_IMPELLER_GLES3_PROC(PROC) PROC(BlitFramebuffer);
|
||||
|
||||
#define FOR_EACH_IMPELLER_EXT_PROC(PROC) \
|
||||
PROC(DebugMessageControlKHR); \
|
||||
PROC(DiscardFramebufferEXT); \
|
||||
PROC(FramebufferTexture2DMultisampleEXT) \
|
||||
PROC(PushDebugGroupKHR); \
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "fml/logging.h"
|
||||
#include "impeller/base/validation.h"
|
||||
|
||||
namespace impeller {
|
||||
@@ -233,6 +234,13 @@ bool ReactorGLES::ConsolidateHandles() {
|
||||
|
||||
bool ReactorGLES::FlushOps() {
|
||||
TRACE_EVENT0("impeller", __FUNCTION__);
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
// glDebugMessageControl sometimes must be called before glPushDebugGroup:
|
||||
// https://github.com/flutter/flutter/issues/135715#issuecomment-1740153506
|
||||
SetupDebugGroups();
|
||||
#endif
|
||||
|
||||
// Do NOT hold the ops or handles locks while performing operations in case
|
||||
// the ops enqueue more ops.
|
||||
decltype(ops_) ops;
|
||||
@@ -247,6 +255,16 @@ bool ReactorGLES::FlushOps() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReactorGLES::SetupDebugGroups() {
|
||||
// Setup of a default active debug group: Filter everything in.
|
||||
proc_table_->DebugMessageControlKHR(GL_DONT_CARE, // source
|
||||
GL_DONT_CARE, // type
|
||||
GL_DONT_CARE, // severity
|
||||
0, // count
|
||||
nullptr, // ids
|
||||
GL_TRUE); // enabled
|
||||
}
|
||||
|
||||
void ReactorGLES::SetDebugLabel(const HandleGLES& handle, std::string label) {
|
||||
if (!can_set_debug_labels_) {
|
||||
return;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "flutter/fml/closure.h"
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "impeller/base/thread.h"
|
||||
#include "impeller/renderer/backend/gles/handle_gles.h"
|
||||
@@ -30,7 +29,7 @@ class ReactorGLES {
|
||||
|
||||
using Ref = std::shared_ptr<ReactorGLES>;
|
||||
|
||||
ReactorGLES(std::unique_ptr<ProcTableGLES> gl);
|
||||
explicit ReactorGLES(std::unique_ptr<ProcTableGLES> gl);
|
||||
|
||||
~ReactorGLES();
|
||||
|
||||
@@ -63,8 +62,7 @@ class ReactorGLES {
|
||||
|
||||
LiveHandle() = default;
|
||||
|
||||
explicit LiveHandle(std::optional<GLuint> p_name)
|
||||
: name(std::move(p_name)) {}
|
||||
explicit LiveHandle(std::optional<GLuint> p_name) : name(p_name) {}
|
||||
|
||||
constexpr bool IsLive() const { return name.has_value(); }
|
||||
};
|
||||
@@ -100,6 +98,8 @@ class ReactorGLES {
|
||||
|
||||
bool FlushOps();
|
||||
|
||||
void SetupDebugGroups();
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ReactorGLES);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "impeller/renderer/backend/gles/render_pass_gles.h"
|
||||
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "fml/closure.h"
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/renderer/backend/gles/device_buffer_gles.h"
|
||||
#include "impeller/renderer/backend/gles/formats_gles.h"
|
||||
|
||||
Reference in New Issue
Block a user