glew icon indicating copy to clipboard operation
glew copied to clipboard

Remove #include <KHR/khrplatform.h>

Open glebm opened this issue 4 years ago • 2 comments

I've noticed that GLEW includes the <KHR/khrplatform.h> header. This header should not be included directly.

https://github.com/nigels-com/glew/blob/fb0f210598ef1a55fcf061c0a0484491881fc6d0/auto/src/eglew_head.h#L27

Source: https://github.com/rockchip-linux/libmali/issues/66#issuecomment-767218749

glebm avatar Jan 28 '21 17:01 glebm

I'm not sure there is enough information here to take action on this. Can anyone shed further light?

nigels-com avatar Mar 09 '21 00:03 nigels-com

Unfortunately, the link above is no longer valid.

Honestly, I don´t see any reason why this should not be included. From https://github.com/KhronosGroup/EGL-Registry/blob/57b4876de0f33677ece92dd9de0ef105ce69139d/api/KHR/khrplatform.h

 * This file should be included as
 *        #include <KHR/khrplatform.h>
 * by Khronos client API header files that use its types and defines.

Using it is actually the only way to guarantee matching API definitions across multiple headers. GLEW defines the API, and thus should use it.

Now, there may be a problem if one header does use it, and another does not, see e.g.: https://github.com/KhronosGroup/OpenGL-Registry/pull/183/files

The correct approach is obviously to use khrplatform.h everywhere. In case this is not possible (because someone uses some outdated vendor GL header files, which use a different definition), it may work to only include khrplatform.h in case e.g. GLByte has not been defined previously.

StefanBruens avatar Sep 11 '22 21:09 StefanBruens