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

Enable MX option for EGL as well #356

Closed
ao2 opened this issue Feb 8, 2022 · 5 comments
Closed

Enable MX option for EGL as well #356

ao2 opened this issue Feb 8, 2022 · 5 comments

Comments

@ao2
Copy link

ao2 commented Feb 8, 2022

Hi,

I am using glad2 and I found that the MX option available for the GL wrappers can also help in my specific case to avoid symbols collisions when linking to other components which also use glad, as an alternative to #198

Would it make sense for the MX option to also affect the EGL wrappers generation in a way similar to GL?

Thanks, Antonio

@Dav1dde
Copy link
Owner

Dav1dde commented Feb 8, 2022

As far as I am aware all the EGL functions are not tied to a context. The display argument is just there to correctly infer the maximum supported version. So API wise a MX option doesn't make sense.

For the vendoring usecase, it's probably still better to vendor the symbols (rename the prefix) or require the symbols to be linked in from the "user". The problem with MX is, it makes the code generation so much harder to maintain that I would not want to add it for something that can be solved with a sed one-liner.

@ao2
Copy link
Author

ao2 commented Feb 8, 2022

My naive rationale was that the EGL functions are still loaded and so even if link-time symbols collision for the glad_* symbols can be solved with a custom prefix, there could still be runtime overrides of the egl* symbols if multiple components load them using glad independently, with different sets of extensions even.

In my mind #198 addresses a link-time problem, while the MX/GladGLContext mechanism addresses a run-time problem.

However I am not expert enough to insist on that 😄

@ao2
Copy link
Author

ao2 commented Feb 8, 2022

Or were you suggesting to also prefix the egl* symbols for the vendoring usecase?

@Dav1dde
Copy link
Owner

Dav1dde commented Feb 8, 2022

All glad symbols are prefixed with glad_, so are the egl functions. The egl* functions you use are just a macro to glad_egl*, so you can just replace all occurences of glad_ with glad_mylib_.

E.g.:

GLAD_API_CALL PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface;
#define eglCreateWindowSurface glad_eglCreateWindowSurface

@ao2
Copy link
Author

ao2 commented Feb 8, 2022

Ah, right the egl* symbols are only in the header file, I was overlooking this.
Thanks for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants