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

Add NDEBUG flag to non-debug builds #91

Merged
merged 1 commit into from
Jan 18, 2025
Merged

Add NDEBUG flag to non-debug builds #91

merged 1 commit into from
Jan 18, 2025

Conversation

chip2n
Copy link
Contributor

@chip2n chip2n commented Jan 18, 2025

I noticed that the performance of web builds was terrible due to a lot of calls to glGetError, which as far as I can tell shouldn't be called in release builds at all. Turns out SOKOL_DEBUG is defined even when using -Doptimize=ReleaseSafe. I may be missing something obvious, but shouldn't NDEBUG be defined in this case? 👀

@floooh
Copy link
Owner

floooh commented Jan 18, 2025

Hmm, interesting that Zig doesn't define that automatically in release builds.

Also looks like the latest Zig nightly broke the bindings, I'll need to to look into that first.

@chip2n
Copy link
Contributor Author

chip2n commented Jan 18, 2025

Seems like Zig does define it for ReleaseFast and ReleaseSmall (https://github.com/ziglang/zig/blob/f38d7a92cc1ca8059ba909a82f2f944966b52296/src/Compilation.zig#L5943), but not for ReleaseSafe.

I guess ReleaseSafe does imply having more safeguards in place, so using glGetError kind of makes sense (and I don't see any difference in performance when building for desktop). However, I'd love to be able to do my web builds with ReleaseSafe for the standard safety stuff Zig does, while avoiding glGetError calls on the Sokol side.

@floooh
Copy link
Owner

floooh commented Jan 18, 2025

Yeah totally makes sense (both Zig's ReleaseSafe behaviour, and not wanting to run glGetError in ReleaseSafe) - it will also disable the asserts in the C code, but I guess that's also fine and expected.

The CI error was about a naming convention change btw, but now I'm seeing a more mysterious problem with the Windows version (all unrelated to your PR, so don't worry, but I want to get the sokol-zig CI green again first before merging your PR).

@floooh floooh merged commit 29c59b1 into floooh:master Jan 18, 2025
0 of 3 checks passed
@floooh
Copy link
Owner

floooh commented Jan 18, 2025

..and merged. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants