glow
glow copied to clipboard
EGL: C syntax
For example
https://github.com/errcw/glow/blob/master/xml/spec/egl.xml#L179
gives
DEFAULT_DISPLAY = ((EGLNativeDisplayType)0)
needs to be rewritten to
DEFAULT_DISPLAY = C.EGLNativeDisplayType(0)
UPDATE: needs more work ./package.go:120: cannot convert 0 (type int) to type C.EGLNativeDisplayType
CGO needs another headers
38: error: 'EGLClientPixmapHI' undeclared (first use in this function)
relevant cgo bug: cmd/cgo: request for better error messages http://code.google.com/p/go/issues/detail?id=8442
The issue with C.EGLClientPixmapHI (and C.AHardwareBuffer) is that they're declared as struct EGLClientPixmapHI { ... }
– note the absence of a typedef – but then used as C.EGLClientPixmapHI instead of C.struct_EGLClientPixmapHI.
And instead of the DEFAULT_DISPLAY = ((EGLNativeDisplayType)0)
issue, we now have a DEFAULT_DISPLAY = EGL_CAST(EGLNativeDisplayType, 0)
issue. eglplatform.h seems to define EGL_CAST as #define EGL_CAST(type, value) ((type) (value))
The incorrect struct types boil down to this difference in <param>
formats in the GL and EGL specs:
gl.xml: <param group="cl_context"><ptype>struct _cl_context</ptype> *<name>context</name></param>
egl.xml: <param>struct <ptype>EGLClientPixmapHI</ptype> *<name>pixmap</name></param>
The struct
is not part of the ptype.
One final issue is the large number of object types, such as EGLConfig, EGLNativeDisplayType, and many others. I'm reluctant to change all of these to uintptr, but I don't think glow has a mechanism for making these first class types?
I still cannot get EGL to compile. It is still showing the could not determine kind of name for C.AHardwareBuffer could not determine kind of name for C.EGLClientPixmapHI errors, etc. This is compiling under Windows. Is this supposed to work now?