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

[OpenGL] use GLAD as API loader (replace GLEW) #819

Merged
merged 14 commits into from
Apr 21, 2020

Conversation

archibate
Copy link
Collaborator

@archibate archibate requested a review from yuanming-hu April 19, 2020 14:57
@archibate
Copy link
Collaborator Author

archibate commented Apr 19, 2020

glad is not a library, it's a python package that generate codes.
We can generate our own external/glad, without any library loading required.
(If I got its point correctly)

@archibate
Copy link
Collaborator Author

archibate commented Apr 19, 2020

Local test passing. Do you have a win environment?

Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

Thanks! Let's see if glad is more portable than glew (I believe so). Only major thing to fix here: the glad files are too big (1.6 MB) in total - could you please use a submodule (just like https://github.com/taichi-dev/glew-ready)?

taichi/backends/opengl/opengl_api.cpp Outdated Show resolved Hide resolved
@yuanming-hu
Copy link
Member

Local test passing. Do you have a win environment?

I do. I can help test on Windows once this is merged.

@archibate
Copy link
Collaborator Author

Thanks! Let's see if glad is more portable than glew (I believe so). Only major thing to fix here: the glad files are too big (1.6 MB) in total - could you please use a submodule (just like https://github.com/taichi-dev/glew-ready)?

To be clear this is not a repo, glad is a command line tool that generates this dir (glad --out-path=external/glad). So two choices:

  1. taichi-dev/glad-ready as submodule
  2. let user run glad themselves (may harm gfw users since it downloads a huge xml file from khr's offical repo)

1 sounds far more better but I'm not sure if the external/glad generated in Linux can work on Windows (and other Linux dist) too, if you could do me a favor...

@archibate archibate requested a review from yuanming-hu April 20, 2020 03:54
@yuanming-hu
Copy link
Member

To be clear this is not a repo, glad is a command line tool that generates this dir (glad --out-path=external/glad).

I know, we should probably just include the generated files instead of the glad source in the submodule, and update the submodule when necessary.

You might need to generate both GLX (Linux) and WGL (Windows) versions using https://glad.dav1d.de/ or a downloaded glad.

I'm happy to test for you on Windows when you are ready.

@archibate
Copy link
Collaborator Author

archibate commented Apr 20, 2020

You might need to generate both GLX (Linux) and WGL (Windows) versions using https://glad.dav1d.de/ or a downloaded glad.

It seems like current glad.c already includes WGL support:

https://github.com/taichi-dev/glad-ready/blob/6e0265ca71db319da02fe4bdfead2430e089d510/src/glad.c#L670

It detects _MSC_VER and _WIN32, so it's generic if no --spec specified.

We only need glad_wgl.c when we want some opengl+win32 specific glue functions like HWND &PRECT paintings&bindings or whatever... And we didn't use that, we only use compute shaders.

@yuanming-hu
Copy link
Member

yuanming-hu commented Apr 20, 2020

Now it works on Windows and all tests pass :-) Great job!

image

Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

This looks great! Thank you. This is a great step towards v0.6.

Just a few very minor things:

I'll merge this after these are resolved.

@archibate
Copy link
Collaborator Author

All done! Except for:

Hide/remove https://github.com/taichi-dev/glew-ready from taichi-dev

Sadly I can't find the Settings section in this repo... maybe I don't have admin access to it? Could you remove it or transfer ownership to me? Thanks!

@archibate archibate requested a review from yuanming-hu April 21, 2020 02:18
python/taichi/lang/__init__.py Outdated Show resolved Hide resolved
@yuanming-hu
Copy link
Member

All done! Except for:

Hide/remove https://github.com/taichi-dev/glew-ready from taichi-dev

Sadly I can't find the Settings section in this repo... maybe I don't have admin access to it? Could you remove it or transfer ownership to me? Thanks!

Thanks for fixing everything. Now you are the admin of glew-ready. Could you try again?

@archibate archibate requested a review from yuanming-hu April 21, 2020 02:35
Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

Thanks for your patience. I'll merge this once CI passes. I plan to release v0.5.15 today or tomorrow with OpenGL shipped experimentally and then release v0.6 later this week.

@archibate
Copy link
Collaborator Author

CI is passed!

@yuanming-hu yuanming-hu merged commit 16370e9 into taichi-dev:master Apr 21, 2020
@archibate archibate mentioned this pull request Apr 23, 2020
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants