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

GL version being reported is wrong? #94

Open
Fancy2209 opened this issue Jan 6, 2025 · 4 comments · May be fixed by #98
Open

GL version being reported is wrong? #94

Fancy2209 opened this issue Jan 6, 2025 · 4 comments · May be fixed by #98
Assignees

Comments

@Fancy2209
Copy link

Fancy2209 commented Jan 6, 2025

The readme claims 1.5, but OpenGX itself reports 1.1, is this intended?
/~https://github.com/devkitPro/opengx/blob/master/src/getters.c#L58

@mardy
Copy link
Collaborator

mardy commented Jan 6, 2025

Hi! No, it's indeed a bug! I already have a branch that fixes this, along with other changes. I'll submit it in a few days.

@Fancy2209
Copy link
Author

Fancy2209 commented Jan 6, 2025

Hi! No, it's indeed a bug! I already have a branch that fixes this, along with other changes. I'll submit it in a few days.

Doesn't that bump OpenGX to GL2 though? Or did I misread the diff
Btw really nice to see Shaders on the Wii!

@mardy
Copy link
Collaborator

mardy commented Jan 7, 2025

Doesn't that bump OpenGX to GL2 though? Or did I misread the diff Btw really nice to see Shaders on the Wii!

The code there does

return ogx_get_proc_address("glUseProgram") ? "2.0" : "1.5";

that is, it will return "2.0" only if ogx_get_proc_address() manages to resolve the "glUseProgram" name into a function pointer. If you look at the new code in functions.c, you'll see that this succeeds only if the symbol _ogx_shader_functions which is weakly defined as an empty array at the top of this file will be overshadowed by the same symbol defined in shader_functions.h, which is included in shader.c only. Effectively this means that the real (full) symbol will only be used if the client directly invokes any function defined in shader.c -- and the client will do that only if needs to use the OpenGL 2.0+ functionalities.

@Fancy2209
Copy link
Author

Fancy2209 commented Jan 7, 2025

Doesn't that bump OpenGX to GL2 though? Or did I misread the diff Btw really nice to see Shaders on the Wii!

The code there does

return ogx_get_proc_address("glUseProgram") ? "2.0" : "1.5";

that is, it will return "2.0" only if ogx_get_proc_address() manages to resolve the "glUseProgram" name into a function pointer. If you look at the new code in functions.c, you'll see that this succeeds only if the symbol _ogx_shader_functions which is weakly defined as an empty array at the top of this file will be overshadowed by the same symbol defined in shader_functions.h, which is included in shader.c only. Effectively this means that the real (full) symbol will only be used if the client directly invokes any function defined in shader.c -- and the client will do that only if needs to use the OpenGL 2.0+ functionalities.

Ooohhh I see, that's really smart, I had no idea you could do things like that, I saw those parts of the code but didn't understand how proc_adress would return null, good to know, thanks.

@mardy mardy self-assigned this Jan 17, 2025
@mardy mardy linked a pull request Jan 18, 2025 that will close this issue
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 a pull request may close this issue.

2 participants