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

GLAD is platform specific #2

Closed
gruelingpine185 opened this issue Jul 25, 2023 · 18 comments
Closed

GLAD is platform specific #2

gruelingpine185 opened this issue Jul 25, 2023 · 18 comments

Comments

@gruelingpine185
Copy link
Contributor

gruelingpine185 commented Jul 25, 2023

From my understanding, GLAD is platform specific. Maybe write a section in your README to let users know that they'll have to download a version for their platform from https://glad.dav1d.de/. Same principal goes to the future dependancies. I guess, in addition to above, add it to your .gitignore so that way everyone wont have to re-download GLAD for their system every time a change to the repo occurs.

@cococry
Copy link
Owner

cococry commented Jul 26, 2023

Yes so eventually, the library will just be a single c and h file that you can include to your build. You then have to handle the dependencies yourself. There will probably also be compiled libraries for the different platforms with that you can link. So the glad part will be handled by the user and prebuild for the specific platform

@RHL120
Copy link
Contributor

RHL120 commented Jul 30, 2023

Hmm, I wonder if they have an API that can be used to download GLAD on-build with curl, wget or something like that.
Would this be something you would accept?
PS: I don't see anything platform specific in their options but even if it is not platform specific it would be better to download the deps on-build instead of having them bundled with the repository IMHO.

@gruelingpine185
Copy link
Contributor Author

I don't think they have an api for that. I was wondering the same thing too. I'll ask

@gruelingpine185
Copy link
Contributor Author

Here is the Issue I created: Dav1dde/glad#435

@RHL120
Copy link
Contributor

RHL120 commented Jul 30, 2023

I don't think they have an api for that. I was wondering the same thing too. I'll ask

When you hit the generate button a POST request is made to /generate with the following example content:
language=c&specification=gl&api=gl%3D4.6&api=gles1%3D1.0&api=gles2%3Dnone&api=glsc2%3Dnone&profile=compatibility&loader=on

@gruelingpine185
Copy link
Contributor Author

from that, i can't just tack on ...&platform=macos can I? Is there docs for that?

@RHL120
Copy link
Contributor

RHL120 commented Jul 30, 2023

from that, i can't just tack on ...&platform=macos can I? Is there docs for that?

I don't think there is an option for macos. As a side note I don't think there is anything OS specific in there. files are just C as far as I can tell. I don't think there are any docs I just used used the network tab in the dev tools on my browser but if you would like to know more the source code would probably be a good place to start:
https://github.com/Dav1dde/glad-web/blob/f2659ebfb9e54b9d72c0cb806c8a27724f8719bf/gladweb/views/index.py#L116

@gruelingpine185
Copy link
Contributor Author

Alr. Thx so much.

@RHL120
Copy link
Contributor

RHL120 commented Jul 30, 2023

This should give you back the generated url:

curl -X POST -d "language=c&specification=gl&api=gl%3D1.3&api=gles1%3Dnone&api=gles2%3Dnone&api=glsc2%3Dnone&profile=compatibility&loader=on" --max-redirs 0 https://glad.dav1d.de/generate |grep "You should" |sed -e 's|<p>.*">||g' -e 's|</a>.*||g' | tr -d '\n'

It is a bit messy, there is probably a better way to do it

@Dav1dde
Copy link

Dav1dde commented Jul 30, 2023

There is nothing platform specific which glad needs to know, it does not matter on which or for which platform you generate, you will always get the same sources and headers.

PS: I don't see anything platform specific in their options but even if it is not platform specific it would be better to download the deps on-build instead of having them bundled with the repository IMHO.

I recommend you to just include the files in your repository, faster build times, less dependencies (Python + Jinja) and nice diffs when you re-generate the files.

This should give you back the generated url:

curl -X POST -d "language=c&specification=gl&api=gl%3D1.3&api=gles1%3Dnone&api=gles2%3Dnone&api=glsc2%3Dnone&profile=compatibility&loader=on" --max-redirs 0 https://glad.dav1d.de/generate |grep "You should" |sed -e 's|<p>.*">||g' -e 's|</a>.*||g' | tr -d '\n'

I'd ask you not to do that, it's fine if you use this as a one (or two-) time script to regenerate automatically, but if it is integrated into your builds this will generate a bunch of files over and over on my server. It also may break when I update the website.

@gruelingpine185
Copy link
Contributor Author

I think the response I received from the creator of GLAD says enough. Essentially they said that it isn't platform specific, but the underlying APIs and contexts are. My bad. With that in mind, This may be a good spot to close this issue. Thanks for all of your input and support to correct my misunderstanding :)

@brmarkus
Copy link

brmarkus commented Jun 1, 2024

Explicitely there is nothing platform-specific, as to my understanding.
Implicitely it is - like what versions, what "dialect" is supported.

In my case I get the following when trying to run todo on my "platform":

$ ./todo
[LEIF ERROR]: Failed to compile vertex shader.
Leif: [INFO]: 0:1(10): error: GLSL 4.60 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

[LEIF ERROR]: Failed to compile fragment shader.
Leif: [INFO]: 0:1(10): error: GLSL 4.60 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

[LEIF ERROR]: Failed to open font file '/usr/share/todo/fonts/inter-bold.ttf'

Segmentation fault (core dumped)

It's easy to fix - just download my "platform specific GLAD" (h and c file) (compatible to up to v4.50 only instead of v4.60 todo was built with by default) and rebuild todo.

EDIT: Sorry, forgot to mention I needed to update the version information of the fragment- and vertex-shader:

https://github.com/cococry/leif/blob/main/leif.c#L433 (using 450 instead of 460)
https://github.com/cococry/leif/blob/main/leif.c#L475 (using 450 instead of 460)

@cococry
Copy link
Owner

cococry commented Jun 1, 2024

okay, so changing the version to 450 in the shaders made it work and didn't cause any graphical bugs?

@brmarkus
Copy link

brmarkus commented Jun 1, 2024

At least not in the context of the todo application - I came here from one of you Youtube videos about todo.

@cococry
Copy link
Owner

cococry commented Jun 1, 2024

okay. i will be testing this and if it does not cause any issues, will add it to leifs main branch.

@brmarkus
Copy link

brmarkus commented Jun 1, 2024

hold on, hold on... this happened on one of my very constrained and embedded system plus using remote-display-X11-screen-forwarding to a very old laptop :-P just commenting on how "implicitely" GLAD can result on platform-specific behaviour/dependencies.

It works out of the box on a more modern, Ubuntu-22.04-Intel-Core-i7 based system, natively.

@cococry
Copy link
Owner

cococry commented Jun 1, 2024

hahaha okay didn't know that 😅

@brmarkus
Copy link

brmarkus commented Jun 1, 2024

Now more experiments with todo and also with lyssa with my changes to GLSL version v450 - I haven't noticed visual artifacts.
But of course that might have only scratched on leif's surface... I haven't analyzed what in detail are the differences between v4.5.0 and v4.6.0.

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

No branches or pull requests

5 participants