-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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] Ship OpenGL backend #664
Comments
And release that in |
How about just make use of |
We are building from source. So we should just include glew and glfw as submodules, like spdlog.
|
May also include llvm&clang as submodules? Yeah they are big repos, maybe just a dir containing taichi-llvm.zip? |
I think we just need exactly one submodule: taichi_assets can done all this, and make CI happy :) |
Unfortunately, no. LLVM itself takes > 1h to build on the CI machines... |
It's ok since we just use their binaries :) |
I mean, create a repo, contains taichi-llvm-8.0.1-linux-x64.zip, taichi-llvm-8.0.1.zip, etc., then include that repo as a submodule. |
Yeah we used to have something similar: https://github.com/yuanming-hu/taichi_runtime The issues are
We can, of course, write a script to download corresponding LLVM binaries adaptively. For GLFW/GLEW, since they are lightweight, we can simply include them as submodules and build from source. (I'm not sure if there's gonna be any build issues of GL libraries on Travis/AppVeyot where no GPU/OpenGL is available. But let's see...) |
The reason we use our own GUI system is to avoid portability issues of OpenGL: Taichi's GUI systems work on machines without OpenGL. |
Also found http://www.itgo.me/a/2256112962039115366/request-a-specific-opengl-context-version-in-glfw3:
|
How about to distribute |
I think that's too many packages to release and will bring troubles to users/developers. Ultimately we should end up with a single |
https://github.com/glfw/glfw They are both big repos, surely will delay the clone&building process... |
Can we include it in |
Actually, glfw-3.2.2 takes only 7.85 seconds to build on my end with 2 CPU cores. They are C libraries and they compile very fast. Requiring users to install anything is harder than we think. Taichi used to depend on gcc-7 and 99% of the users don't know how to install that. |
Wow, then how about the clone time?
Agree, and I had a hardtime downloading Btw, is OpenGL okay now on win? I didn't have a env to test that... |
I'm in US and cloning takes < 2s. I do understand people in China might suffer from poor network conditions...
Right,
I'll test it on Windows once GLFW and GLEW are included as submodules.
It would be great to concisely tell people how to install |
Do we need run this after
See #747, I added |
We do. Thanks! |
See f19f228 to check if I'm understanding right. |
You need |
I did, I tried any combination of these, and no work done :( |
Happy cloning now! Thanks to the |
Sounds so kidding... In GFW it's common to clone for hours and you don't dear to shutdown the computer until it's done...why no 断点续传 support in git...now I knows: maybe the US users don't have such problem at all... |
My considerations:
Also found there is only |
You can only do
Will the submodule clone all? No, |
Why!!! |
I give up submodule. It's wise to let user install glfw on their own, like libtinfo does. |
It will not overwrite since we are only using the compiled static libraries. In fact, we should not use the users' glfw and glew, since there's no control on their own glf/ew versions. For example, depending on users' gcc/clang verseion has lead to tons of issues that are hard to fix. E.g. #745
Once we enable shallow clone the total data to be fetched should be <3MB. Note that we do not need
Right, we do not need to
There might be some extra setup. We should probably actually add the submodules when committing. See https://github.com/taichi-dev/taichi/tree/master/external - there is a I understand that the network condition in China is probably very poor. If it's too hard I can try to set it up for you next week. |
I would suggest not to include them as submodules, but let user manually clone or download them like llvm. |
My feeling is that will further complexify the development installation process. We have no choice for LLVM since LLVM is too big. GLFW and GLEW are just tiny libraries. |
Please download this glew-2.2.0-src.tgz file: |
Yes, GLFW build succeed. But...the current master branch of GLEW cannot build at all :(the file src/glew.c is missing) |
fyi pls do special care for glew, i.e. let them download the buildable snapshot package: https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20200115.tgz/download. |
Sounds good - thanks for the hard work. I'll take a look at this in the afternoon. Good night! |
That's what cmake to slove... |
We should not use the HEAD of the master branch but the commit with version 2.1.0 instead. Master branches are sometimes unstable unless rules are made. #760 introduces GLFW as a submodule and this will save the developers from manually installing it. You are right that GLEW seems slightly out-dated. For now, a temporary fix is to:
Ultimately we want to remove the dependency on OpenGL API loaders completely, using a similar approach as #756. This is more C++ coding work (a few hundred LoC I guess, making use of
|
I found |
I know you're thinking about something like: auto glCompileShader = dlsym("libGLEW.so", "glCompileShader"); However, this is actually impossible since GLEW already done the wraping work for us:
Now you may tell me The best sol is to statically-link-against GLEW, it's already a DynamicLoader itself :) |
Right, that's why I estimate the implementation to be a few hundred lines of code instead of tens of lines of code... Let see if glew works with CMake, if so then we are good. |
TODO: move to GLAD. |
I think we've done here, and v0.6.0 is all done except some little PyPI specs? |
We are very very close. Just one final thing (as also mentioned in #843 (comment)) can we make |
Concisely describe the proposed feature
As we approach v0.6 it's time to think about how to ensure users/developers can easily access the OpenGL backend. I'm setting up testing environments on my GPU matches, yet I find that the OpenGL build process is not portable enough. For example, users may have to
apt install libglew-dev libglfw3-dev
on Ubuntu.Describe the solution you'd like (if any)
Fortunately, the two libraries are fast to build ( < 10 seconds) and generate small binaries (< 1MB). So we can simply build from source and statically link them into
libtaichi_core.so
, just like LLVM.glew
andglfw
(3.3.2 I guess) as submodules of Taichi.CMakeLists.txt
usingadd_subdirectory
. Make sure we use static linking.Additional comments
Ultimately we might want to remove the dependency on
glew
andglfw
. We only use limited functionalities of these libraries. For example, we only useglfw
to create the OpenGL context - not sure if there's an easy way without introducing a dependency. For now, we can stick to the current solution.The text was updated successfully, but these errors were encountered: