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

Fixes some bugs in examples and factorize some code, test them in CI #61

Merged
merged 7 commits into from
Jul 15, 2024

Conversation

illwieckz
Copy link
Member

Fixes some bugs in examples and factorize some code.

The examples are now tested in CI.

illwieckz added 5 commits July 7, 2024 23:21
Fix execution on machines having more than 15 threads/cores.
Also substract by 1 (the main thread) the amount of all threads
to get the amount of helper thread in all cases.
@illwieckz
Copy link
Member Author

The example1 CRN to DDS test doesn't work on macOS CI, I don't know why because I don't reproduce it on my end on macOS.

@illwieckz illwieckz force-pushed the illwieckz/examples branch from a8da546 to bf1afd3 Compare July 8, 2024 01:55
@illwieckz
Copy link
Member Author

illwieckz commented Jul 8, 2024

running: build/example1 c test/unvanquished_64.png -crn -out build/test/9/unvanquished_64.crn
example1 - Version v1.04 Built Jul  8 2024, 01:50:07
Loading source file: test/unvanquished_64.png
Source file size: 7471, Dimensions: 64x64
Actual Components: 4
Compressing to DXT5
Generating mipmaps using filter "kaiser"
Generated 6 mipmap levels in 0.004s
Compressing using quality level 128
Processing: 100%
Compressed to 2210 bytes, quality level: 128, effective bitrate: 3.237502
Writing CRN file: build/test/9/unvanquished_64.crn
running: build/example1 d build/test/9/unvanquished_64.crn -out build/test/9/unvanquished_64.dds
Loading source file: build/test/9/unvanquished_64.crn
Decompression mode only supports .dds or .crn files!
+ base64 build/test/9/unvanquished_64.crn
SHgAYoiYAAAIoquhAEAAQAcBAgAAAAAAAAAAAAEAAAAAAABiAAGMAIsAAe4AAd0ApAADywAAUwAyAAQeAADpADoAogAFBwAABakAAAeTAAAIPQAACHMAAAiCAAAIjwAACJoAgiwBG1BBBBLvN5NlUQhEDS/twBAfJAIgwww0k3JS5mg4GcFDSeW2NoCAcIWhCEInLprVIDn96AJApCAWDrMAUgDxwBa0SurOqUVmKYgUl2guMACROXV2S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GZSEhGsQrxsXMZPMjACUedsX12NHDgPC2jGxJ59sxkLwFAYi9FYZtEQl8qTkps/is8MbMzWn6GbWPmvf4R19TCuxGFWFdGriqJNWZ5r6pa6QIq/hNXQiaqRFVCrWeUX0g+REc/b2EhISEhISMkSEhISEhIyo6h2It+1+PYQOh7Ccwj9md5J7CBVoMNrlrU9KOaTl5DO+3LP/6vLfuycOy/bSF9KNTI17+lGtYAztcnK3YMveS28vLmYxMto6auVtRDXjKSkvdjG8n39PF0fIOrTK/qLWkOtUm44nwSs+uflpjHnKXX02Mvu+zQKQMA6fLp1mmSUvfUJnt+B05tcyf3g6U2+dLJdpRrP07kNMje1N0oMeDGqq8Qm3xpcaikxQdYC2UpxbMzHBGusrw534PLn0c/vrfD08m1Jvlaw/vp6FufCFmejPH/ZOv5/bT+jXOpdYaoaWfiDv5m70k/3vDX99OLh2+oTUd321kw9sE/f6X9AHyeMXfxyXfibheY38eS6F0LoXQ=

If I decode that file on my end and run crunch (even macOS crunch) on it, it says it's a valid crn file and decompresses it!

But it doesn't work in CI…

@illwieckz illwieckz force-pushed the illwieckz/examples branch from bf1afd3 to 39ff192 Compare July 8, 2024 02:02
@illwieckz illwieckz marked this pull request as draft July 8, 2024 02:06
@illwieckz illwieckz force-pushed the illwieckz/examples branch from ff76d5d to 2dc2801 Compare July 8, 2024 02:13
@illwieckz illwieckz marked this pull request as ready for review July 8, 2024 02:13
@illwieckz
Copy link
Member Author

The example1 CRN to DDS test doesn't work on macOS CI, I don't know why because I don't reproduce it on my end on macOS.

Now fixed, a null-terminator was missing.

@illwieckz illwieckz force-pushed the illwieckz/examples branch 5 times, most recently from 41eecb0 to 4e24afa Compare July 8, 2024 03:52
@illwieckz
Copy link
Member Author

I don't know why the example1 test doesn't run on Windows MSVC Appveyor CI , while on my end a MinGW build runs correctly on wine.

@slipher
Copy link
Member

slipher commented Jul 8, 2024

I don't know why the example1 test doesn't run on Windows MSVC Appveyor CI , while on my end a MinGW build runs correctly on wine.

I reproduce a crash. It crashes when calling splitpath_s. I don't know what exactly was wrong, but anyway there is already a portable version file_utils::split_path. So example_platform files shouldn't be needed.

@illwieckz
Copy link
Member Author

illwieckz commented Jul 8, 2024

I don't know what exactly was wrong, but anyway there is already a portable version file_utils::split_path. So example_platform files shouldn't be needed.

It should be doable for example1 (I have a PoC that works in a branch), but that would be more problematic for example2 that is meant to be an example of how to not rely on crnlib:

example2

Shows how to transcodec CRN files to DDS using only
the functionality in inc/crn_decomp.h. It does not link against against
crnlib.lib or depend on it in any way. (Note: The complete source code,
approx. 4800 lines, to the CRN transcoder is included in inc/crn_decomp.h.)

@illwieckz illwieckz force-pushed the illwieckz/examples branch from 4e24afa to e090f43 Compare July 8, 2024 21:58
@illwieckz
Copy link
Member Author

illwieckz commented Jul 8, 2024

So example1 and example3 now use crnlib for both split_path and strcpy_safe, but example2 uses custom code to not link against crnlib.

@illwieckz illwieckz force-pushed the illwieckz/examples branch 3 times, most recently from feb8fc9 to 89bc6f7 Compare July 10, 2024 18:11
@illwieckz
Copy link
Member Author

This also extends the testing by running cross-compiled executables when possible (using wine, qemu-user…).

test/test.py Outdated Show resolved Hide resolved
test/test.py Outdated Show resolved Hide resolved
@illwieckz illwieckz force-pushed the illwieckz/examples branch 3 times, most recently from 6652709 to ac88f0a Compare July 13, 2024 19:02
@illwieckz illwieckz force-pushed the illwieckz/examples branch from ac88f0a to ec36144 Compare July 13, 2024 23:29
@illwieckz
Copy link
Member Author

illwieckz commented Jul 13, 2024

To avoid some warnings related to strncpy I imported a copy (without asserts) of strcpy_safe from crn_strutils.cpp into example2.cpp (which is expected to not build against libcrn).

I also added two commits fixing two kind of warnings in examples.

@illwieckz illwieckz force-pushed the illwieckz/examples branch 2 times, most recently from fa51891 to 3dadb5c Compare July 14, 2024 00:05
example2/example2.cpp Outdated Show resolved Hide resolved
@illwieckz illwieckz force-pushed the illwieckz/examples branch 2 times, most recently from a0eca7d to d0d6b4e Compare July 14, 2024 23:40
@slipher
Copy link
Member

slipher commented Jul 15, 2024

LGTM

@illwieckz illwieckz force-pushed the illwieckz/examples branch from d0d6b4e to 632d422 Compare July 15, 2024 23:21
@illwieckz illwieckz merged commit f60f547 into master Jul 15, 2024
14 checks passed
@illwieckz illwieckz deleted the illwieckz/examples branch July 15, 2024 23:27
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