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

Rename the EGL members #51

Merged
merged 1 commit into from Jun 20, 2019

Conversation

Projects
None yet
2 participants
@psaavedra
Copy link
Member

commented Jun 20, 2019

Renaming of the egl... members as s_ avoiding identifiers in our code
clashing with official names of functions is definitely a good idea to
avoid redeclaration errors like this:

  src/ws.cpp:74:33: error: 'void* (* eglCreateImageKHR)(EGLDisplay,
  EGLContext, EGLenum, EGLClientBuffer, const EGLint*)' redeclared as
  different kind of symbol
  static PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;

The argument to eglGetProcAddress() has nothing to do with the name of
the variable. It is the name of a symbol from the EGL API:
https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglGetProcAddress.xhtml.

Also added non-null asserts to those pointers to make more evident
crashes due to null in the future (for example: changes in the name of
the symbols):

    assert(s_eglBindWaylandDisplayWL);
    assert(s_eglQueryWaylandBufferWL);
    assert(s_eglCreateImageKHR);
    assert(s_eglDestroyImageKHR);
    assert(s_eglQueryDmaBufFormatsEXT);
    assert(s_eglQueryDmaBufModifiersEXT);
Rename the egl members
Renaming of the egl... members as s_ avoiding identifiers in our code
clashing with official names of functions is definitely a good idea to
avoid redeclaration errors like this:

  src/ws.cpp:74:33: error: 'void* (* eglCreateImageKHR)(EGLDisplay,
  EGLContext, EGLenum, EGLClientBuffer, const EGLint*)' redeclared as
  different kind of symbol
  static PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;

The argument to eglGetProcAddress() has nothing to do with the name of
the variable. It is the name of a symbol from the EGL API:
<https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglGetProcAddress.xhtml>.

Also added non-null asserts to those pointers to make more evident
crashes due to null in the future (for example: changes in the name of
the symbols):

    assert(s_eglBindWaylandDisplayWL);
    assert(s_eglQueryWaylandBufferWL);
    assert(s_eglCreateImageKHR);
    assert(s_eglDestroyImageKHR);
    assert(s_eglQueryDmaBufFormatsEXT);
    assert(s_eglQueryDmaBufModifiersEXT);
@aperezdc
Copy link
Member

left a comment

LGTM, thanks for the patch! 💪

(Actually, I am a little surprised that this did not cause problems earlier!)

@aperezdc

This comment has been minimized.

Copy link
Member

commented Jun 20, 2019

Merged to the wpebackend-fdo-1.2 branch as commit 318aaf0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.