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

EGL: C syntax #16

Open
capnm opened this issue Jul 28, 2014 · 5 comments
Open

EGL: C syntax #16

capnm opened this issue Jul 28, 2014 · 5 comments
Labels

Comments

@capnm
Copy link
Contributor

capnm commented Jul 28, 2014

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
Copy link
Contributor Author

capnm commented Jul 28, 2014

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

@dominikh
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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?

@asicerik
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants