[Impeller] Fix type conversion warnings seen on Windows when Impeller GL API wrappers log arguments with function types (#181734)

https://github.com/flutter/flutter/pull/181157 introduced a call to the
glDebugMessageCallback API using a lambda as the argument. On Windows
builds this produces a warning about a nonstandard implicit conversion
when the Impeller GL API wrappers try to log the callback argument.
This commit is contained in:
Jason Simmons 2026-01-30 14:19:35 -08:00 committed by GitHub
parent 319ef4eed8
commit dc2b4c6eb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 4 deletions

View File

@ -143,9 +143,9 @@ std::shared_ptr<Context> PlaygroundImplGLES::GetContext() const {
if (gl->GetDescription()->HasDebugExtension()) {
gl->DebugMessageCallbackKHR(
[](GLenum /* source */, GLenum message_type, GLuint /* message_id */,
GLenum /* severity */, GLsizei /* length */, const GLchar* message,
const void* /* user_param */) {
+[](GLenum /* source */, GLenum message_type, GLuint /* message_id */,
GLenum /* severity */, GLsizei /* length */, const GLchar* message,
const void* /* user_param */) {
switch (message_type) {
case GL_DEBUG_TYPE_ERROR_KHR:
FML_LOG(ERROR) << "GL Error: " << message;

View File

@ -51,9 +51,21 @@ struct AutoErrorCheck {
}
};
template <typename Type>
struct ArgLogger {
static void log(std::stringstream& stream, Type arg) { stream << arg; }
};
template <typename R, typename... Args>
struct ArgLogger<R (*)(Args...)> {
static void log(std::stringstream& stream, R (*val)(Args...)) {
stream << reinterpret_cast<void*>(val);
}
};
template <class Type>
void BuildGLArgumentsStream(std::stringstream& stream, Type arg) {
stream << arg;
ArgLogger<Type>::log(stream, arg);
}
constexpr void BuildGLArgumentsStream(std::stringstream& stream) {}