-
Notifications
You must be signed in to change notification settings - Fork 5
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
sokol-header: Assertion failed #5
Comments
First one is easy: Lines 48 to 49 in 1b3d111
The order of The second one is tricky, it's this line: ...but this assert should actually be impossible to hit, because the 0.0f value should have been replaced with This could be some sort of memory corruption or ABI issue. What operating system is this on? Also, stepping to the code in the debugger might help identifying the issue. |
fixed!!
I'm running on Linux. I'll debug it. Also on the other examples, except clear. Although it was replicated line by line. I haven't had the same result... I'll have to see how the LDC2 compiler affects compared to the zig compiler. |
How did you fix it? FWIW, sometimes I've been seeing weird platform-specific ABI related issues in language bindings where the struct params were corrupted on their way to the other language (for instance in Zig on Intel Macs). I'll take care of a couple smaller requests and PRs over the next few days, and will most likely have time to look into the D bindings starting this weekend (unless you need more time for sample code). (in any case I'll try to get a bit familiar with the D toolchain and tinker around with the bindings) |
Yeah, I'm getting these issues in D, including
The problem in the debug still persists, but I've had to rewrite the example followed by rust, instead of zig example. Edit Also, I'm adding a few more examples so that refactoring will also impact the bindgen!!! (e.g.: cube and blend) Any help with revision is welcome! |
Bindgen already translates with a similar interface. Lines 1797 to 1808 in c42a959
Only the examples are not auto-generated, allowing you to use what suits you best (with or without GC). |
This shouldn't matter for the sample code I would think. Personally I would prefer sample code that isn't annotated like this unless absolutely needed. |
Fixed on 0684058 Issue solved on error: undefined reference to symbol __D4core8internal5array11duplication__T8_dupCtfeTaTyaZQpFNaNbNiNfMAaZAya
note: referenced in /Users/runner/work/sokol-d/sokol-d/zig-cache/o/8441520852fd3bf30fcee699975c9b06/debugtext_print.o
error: undefined reference to symbol __D4core8internal5array11duplication__T8_dupCtfeTxaTaZQpFNaNbNiNfMAxaZAa
note: referenced in /Users/runner/work/sokol-d/sokol-d/zig-cache/o/8441520852fd3bf30fcee699975c9b06/debugtext_print.o Thank you!! |
Back to the original topic of the problem. After running some debugging tests, I realized that the error in the assert is related to the fact that the float/double in D is sokol_debugtext.h:3780: sdtx_context_desc_t _sdtx_context_desc_defaults(const sdtx_context_desc_t *): Assertion `res.canvas_width > 0.0f` failed. References |
New brief test in diff --git a/src/sokol/c/sokol_debugtext.h b/src/sokol/c/sokol_debugtext.h
index 09da601..a44a673 100644
--- a/src/sokol/c/sokol_debugtext.h
+++ b/src/sokol/c/sokol_debugtext.h
@@ -3777,6 +3777,7 @@ static sdtx_context_desc_t _sdtx_context_desc_defaults(const sdtx_context_desc_t
res.tab_width = _sdtx_def(res.tab_width, _SDTX_DEFAULT_TAB_WIDTH);
// keep pixel format attrs are passed as is into pipeline creation
SOKOL_ASSERT(res.char_buf_size > 0);
+ SOKOL_ASSERT(!isnan(res.canvas_width));
SOKOL_ASSERT(res.canvas_width > 0.0f);
SOKOL_ASSERT(res.canvas_height > 0.0f);
return res; Output: steps [2/4] debugtext_print... debugtext_print: /home/kassane/sokol-d/src/sokol/c/sokol_debugtext.h:3780: sdtx_context_desc_t _sdtx_context_desc_defaults(const sdtx_context_desc_t *): Assertion `!__builtin_isnan (res.canvas_width)' failed.
run-debugtext_print
└─ run /home/kassane/sokol-d/zig-out/bin/debugtext_print failure
error: the following command terminated unexpectedly:
/home/kassane/sokol-d/zig-out/bin/debugtext_print |
Yeah that's what I also do in the Zig bindings: ...it's important that non-initialized struct items are set to zero. |
Yes, when I started porting the zig script to D, it removed all default values, in consideration of the C concept. Maybe this solves the pipeline shader problem in sokol-tools. |
Occurs in
ReleaseSafe
andDebug
build mode during run:sgl_context
no assertion issue.cc: @floooh
The text was updated successfully, but these errors were encountered: