Use C-width attributes in EGL and GLX guest probes
@@ -8,46 +8,47 @@ module main
88#flag -lGLESv2
99
1010fn C.eglGetPlatformDisplay(u32, voidptr, voidptr) voidptr
11-fn C.eglInitialize(voidptr, &int, &int) u32
11+fn C.eglInitialize(voidptr, &i32, &i32) u32
1212fn C.eglBindAPI(u32) u32
13-fn C.eglChooseConfig(voidptr, &int, &voidptr, int, &int) u32
14-fn C.eglCreatePbufferSurface(voidptr, voidptr, &int) voidptr
15-fn C.eglCreateContext(voidptr, voidptr, voidptr, &int) voidptr
13+fn C.eglChooseConfig(voidptr, &i32, &voidptr, i32, &i32) u32
14+fn C.eglCreatePbufferSurface(voidptr, voidptr, &i32) voidptr
15+fn C.eglCreateContext(voidptr, voidptr, voidptr, &i32) voidptr
1616fn C.eglMakeCurrent(voidptr, voidptr, voidptr, voidptr) u32
1717fn C.eglDestroyContext(voidptr, voidptr) u32
1818fn C.eglDestroySurface(voidptr, voidptr) u32
1919fn C.eglTerminate(voidptr) u32
20-fn C.eglGetError() int
20+fn C.eglGetError() i32
2121fn C.glClearColor(f32, f32, f32, f32)
2222fn C.glClear(u32)
23-fn C.glReadPixels(int, int, int, int, u32, u32, voidptr)
23+fn C.glReadPixels(i32, i32, i32, i32, u32, u32, voidptr)
2424fn C.glGetError() u32
2525fn C.glGetString(u32) &u8
2626
2727fn render() ! {
2828 display := C.eglGetPlatformDisplay(C.EGL_PLATFORM_SURFACELESS_MESA, unsafe { nil }, unsafe { nil })
29- mut major := 0
30- mut minor := 0
29+ mut major := i32(0)
30+ mut minor := i32(0)
3131 if isnil(display) || C.eglInitialize(display, &major, &minor) == 0 {
3232 return error('surfaceless EGL initialization failed: 0x${C.eglGetError():x}')
3333 }
3434 defer { C.eglTerminate(display) }
3535 mut config := voidptr(0)
36- mut count := 0
37- config_attributes := [int(C.EGL_SURFACE_TYPE), C.EGL_PBUFFER_BIT, C.EGL_RENDERABLE_TYPE,
36+ mut count := i32(0)
37+ // EGLint entries are 32-bit even when the V compiler uses a wider int.
38+ config_attributes := [i32(C.EGL_SURFACE_TYPE), C.EGL_PBUFFER_BIT, C.EGL_RENDERABLE_TYPE,
3839 C.EGL_OPENGL_ES2_BIT, C.EGL_RED_SIZE, 8, C.EGL_GREEN_SIZE, 8, C.EGL_BLUE_SIZE, 8,
3940 C.EGL_ALPHA_SIZE, 8, C.EGL_NONE]!
4041 if C.eglBindAPI(C.EGL_OPENGL_ES_API) == 0
4142 || C.eglChooseConfig(display, &config_attributes[0], &config, 1, &count) == 0 || count != 1 {
4243 return error('could not choose an RGBA GLES2 pbuffer configuration: 0x${C.eglGetError():x}')
4344 }
44- size := [int(C.EGL_WIDTH), 1, C.EGL_HEIGHT, 1, C.EGL_NONE]!
45+ size := [i32(C.EGL_WIDTH), 1, C.EGL_HEIGHT, 1, C.EGL_NONE]!
4546 surface := C.eglCreatePbufferSurface(display, config, &size[0])
4647 if isnil(surface) {
4748 return error('could not create an EGL pbuffer: 0x${C.eglGetError():x}')
4849 }
4950 defer { C.eglDestroySurface(display, surface) }
50- attributes := [int(C.EGL_CONTEXT_CLIENT_VERSION), 2, C.EGL_NONE]!
51+ attributes := [i32(C.EGL_CONTEXT_CLIENT_VERSION), 2, C.EGL_NONE]!
5152 context := C.eglCreateContext(display, config, unsafe { nil }, &attributes[0])
5253 if isnil(context) {
5354 return error('could not create a GLES2 context: 0x${C.eglGetError():x}')
@@ -9,27 +9,27 @@ module main
99
1010@[typedef]
1111struct C.XVisualInfo {
12- depth int
12+ depth i32
1313}
1414
1515fn C.XOpenDisplay(&char) voidptr
16-fn C.XDefaultScreen(voidptr) int
17-fn C.XRootWindow(voidptr, int) u64
16+fn C.XDefaultScreen(voidptr) i32
17+fn C.XRootWindow(voidptr, i32) u64
1818fn C.XCreatePixmap(voidptr, u64, u32, u32, u32) u64
19-fn C.XFreePixmap(voidptr, u64) int
20-fn C.XFree(voidptr) int
21-fn C.XCloseDisplay(voidptr) int
22-fn C.glXChooseVisual(voidptr, int, &int) &C.XVisualInfo
19+fn C.XFreePixmap(voidptr, u64) i32
20+fn C.XFree(voidptr) i32
21+fn C.XCloseDisplay(voidptr) i32
22+fn C.glXChooseVisual(voidptr, i32, &i32) &C.XVisualInfo
2323fn C.glXCreateGLXPixmap(voidptr, &C.XVisualInfo, u64) u64
2424fn C.glXDestroyGLXPixmap(voidptr, u64)
25-fn C.glXCreateContext(voidptr, &C.XVisualInfo, voidptr, int) voidptr
26-fn C.glXMakeCurrent(voidptr, u64, voidptr) int
27-fn C.glXIsDirect(voidptr, voidptr) int
25+fn C.glXCreateContext(voidptr, &C.XVisualInfo, voidptr, i32) voidptr
26+fn C.glXMakeCurrent(voidptr, u64, voidptr) i32
27+fn C.glXIsDirect(voidptr, voidptr) i32
2828fn C.glXDestroyContext(voidptr, voidptr)
2929fn C.glClearColor(f32, f32, f32, f32)
3030fn C.glClear(u32)
3131fn C.glReadBuffer(u32)
32-fn C.glReadPixels(int, int, int, int, u32, u32, voidptr)
32+fn C.glReadPixels(i32, i32, i32, i32, u32, u32, voidptr)
3333fn C.glGetError() u32
3434
3535fn main() {
@@ -37,7 +37,8 @@ fn main() {
3737 assert display != unsafe { nil }
3838 defer { C.XCloseDisplay(display) }
3939 screen := C.XDefaultScreen(display)
40- mut attributes := [int(C.GLX_RGBA), C.GLX_RED_SIZE, 8, C.GLX_GREEN_SIZE, 8, C.GLX_BLUE_SIZE, 8, 0]!
40+ mut attributes := [i32(C.GLX_RGBA), C.GLX_RED_SIZE, 8, C.GLX_GREEN_SIZE, 8, C.GLX_BLUE_SIZE,
41+ 8, 0]!
4142 visual := C.glXChooseVisual(display, screen, &attributes[0])
4243 assert visual != unsafe { nil }
4344 defer { C.XFree(visual) }