floooh / sokol-zig

Zig bindings for the sokol headers (https://github.com/floooh/sokol)
zlib License
355 stars 49 forks source link

sg.queryPixelformat() broken #3

Closed floooh closed 3 years ago

floooh commented 3 years ago

...the enum parameter gets broken when handed to the C side (results in some negative number).

floooh commented 3 years ago

...this is almost certainly the same ABI issue I already discovered before, the problem isn't the enum parameter, but the return struct which is <16 bytes, and in this case, the input parameter also gets corrupted on the way from the Zig to the C side.

https://github.com/ziglang/zig/issues/3211

floooh commented 3 years ago

Fixed with by introducing the SOKOL_ZIG_BINDINGS define in the sokol headers, which adds workaround for the ABI problems until they are fixes in Zig.