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

external: Replace glbinding by glad #527

Merged
merged 2 commits into from
Jul 2, 2019
Merged

external: Replace glbinding by glad #527

merged 2 commits into from
Jul 2, 2019

Conversation

scribam
Copy link
Member

@scribam scribam commented Jun 22, 2019

Close #489

Warning: the release build of glad doesn't include pre/post callbacks so I didn't replace the before_callback/after_callback functions by a "glad" equivalent. I am not sure if I should use the debug build to have these callbacks, specially if it can affect performance as mentioned in Dav1dde/glad#132. Any advice?

pent0
pent0 previously requested changes Jun 22, 2019
Copy link
Collaborator

@pent0 pent0 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 taking this work, it's pretty heavy and time-consuming.
I think you need to run clang-format. I notice there are some places where tabs mixed in

src/emulator/renderer/src/compile_program.cpp Outdated Show resolved Hide resolved
src/emulator/renderer/src/renderer.cpp Outdated Show resolved Hide resolved
@pent0
Copy link
Collaborator

pent0 commented Jun 22, 2019

Will leave the ideas of debug GLAD to another devs. Maybe discuss here or on Discord

@petmac
Copy link
Contributor

petmac commented Jun 22, 2019

Is this better than SDL_opengl.h? The reason to use glbinding was for profiling and error checking, which I expect glad doesn’t do.

Also, I’m confused why all the GLenums changed to GLints. That didn’t seem right.

@scribam
Copy link
Member Author

scribam commented Jun 22, 2019

@pent0 My bad, I forgot to run clang-format before to push. It should be ok now.

@pent0 pent0 dismissed their stale review June 22, 2019 15:02

not relevant anymore

@VelocityRa
Copy link
Member

The error checks should definitely be kept for Debug mode.
You could make it a compile-time switch to turn them off optionally if they're that slow.

@scribam
Copy link
Member Author

scribam commented Jun 22, 2019

@petmac glTexParameteriv's third argument type is const GLint * params (see https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtml) that's why I changed the type of the swizzle variable here https://github.com/Vita3K/Vita3K/blob/master/src/emulator/renderer/src/texture.cpp#L29 and to all translate_swizzle functions. glbinding casts the GLenum to a GLint which is why it wasn't an issue:

void glTexParameteriv(GLenum target, GLenum pname, const GLenum * params)
{
    glTexParameteriv(target, pname, reinterpret_cast<const GLint *>(params));
}

I can revert the code related to the GLenums to do something like that if you prefer:

const GLint *const swizzle = reinterpret_cast<const GLint *>(translate_swizzle(fmt));

@pent0 pent0 merged commit 8a0f726 into Vita3K:master Jul 2, 2019
@scribam scribam deleted the glad branch July 2, 2019 15:47
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.

Get rid of glbinding in favour of glad
4 participants