Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[linux] Add GLFW-based proc resolving #184

Merged

Conversation

GeertJohan
Copy link
Contributor

Fixes #170

The default symbol resolver that is used when no specific resolver is given doesn't resolve according to OpenGL features available in the GLFW context. This causes errors for some users.

@stuartmorgan
Copy link
Collaborator

It seems like this is patching over an issue with the engine fix for #135. @chinmaygarde any thoughts on why some configurations are still not working without this? Can it be fixed in the engine?

// Resolves the address of the specified OpenGL or OpenGL ES
// core or extension function, if it is supported by the current context.
static void* GLFWProcResolver(void *user_data, const char *name) {
return (void*) glfwGetProcAddress(name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do end up needing this fix on the embedding side, this needs to be static_cast<void*>(...). This project follow's Google's C++ style guide, which does not use C-style casts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only could get it to work with reinterpret_cast. But please double check what I'm doing because I'm not very familiar with C++.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll need to look at this again when I have more time. Having looked at the types, this is reinterpret-casting a function pointer to a void*, which I believe violates the spec—in which either the engine API is problematic, or there's a missing step here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dug into this more to see what Flutter code this was ultimately interacting with and how they handle the mismatch. It turns out that it eventually comes down to dlsym, so this is the issue described in the Rationale section here. Pushing the requirement for the non-standards-compliant conversion up to this abstract layer, rather than keeping it closer to the dlsym that requires POSIX, does seem like an engine API problem.

However, since the bug is breaking a bunch of people, I'm going to go ahead and land this, and then follow up with the Flutter team separately about whether there should be more changes here at the engine level. Thanks for tracking down the issue!

@GeertJohan GeertJohan changed the title Add GLFW-based proc resolving [linux] Add GLFW-based proc resolving Jan 1, 2019
@stuartmorgan stuartmorgan merged commit 57d7e8d into google:master Jan 2, 2019
@GeertJohan GeertJohan deleted the feature/open-gl-proc-resolver branch January 3, 2019 13:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Linux] Failed to setup Skia Gr context in some configurations
2 participants