glow icon indicating copy to clipboard operation
glow copied to clipboard

EGL: C syntax

Open capnm opened this issue 10 years ago • 5 comments

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

capnm avatar Jul 28 '14 09:07 capnm

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

capnm avatar Jul 28 '14 09:07 capnm

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))

dominikh avatar Sep 29 '18 13:09 dominikh

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.

dominikh avatar Sep 29 '18 15:09 dominikh

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?

dominikh avatar Sep 29 '18 16:09 dominikh

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?

asicerik avatar Nov 12 '18 22:11 asicerik