Open illwieckz opened 3 days ago
It is also worth noting the mismatches only occurs with image formats produced by crnlib (DDS, CRN and KTX files).
How to test for the mismatch:
cmake -S. -Bbuild -DUSE_FAST_MATH=OFF && cmake --build build
test/test.py
to customize -helperThreads
with problematic values.test/test.py
When using the illwieckz/max-threads
branch, it's possible to set -DUSE_MAX_THREADS=64
(or other values) as CMake argument to customize the maximum amount of threads.
I previously noticed that using different value of
-helperThreads
produce different files. I wondered if it was due to a bug.I recently wrote a patch in the
illwieckz/max-threads
branch to set the maximum amount of threads to be usable at build time.Given crunch is supposed to work with a main thread and some helper threads, the amount of helper threads is assumed to be the maximum amount of threads minus one, so it is assumed the tool should work with only two threads.
Building
crunch
with an arbitrary maximum amount of threads can be done like this with theillwieckz/max-threads
branch:When I run a conversion from PNG to TGA it works:
When I run a conversion from PNG to TGA it segfaults, like if it stumbled on some memory issues. It doesn't crash when spawning a thread, it crashes when reading data:
Thanks to this branch I more curious behaviors. I already noticed that using
-helperThreads 3
with the default max amount of threads being 16, crn build was reproducible. It was not with amounts of helper threads higher than 3.But with that branch, I can test different maximum amount of threads:
-helperThreads 3
, the image conversion is reproducible.-helperThreads 4
, I get 6 different files (some DDS, CRN and KTX files).-helperThreads 7
, the image conversion is reproducible.-helperThreads 14
, I get 7 different files (some DDS, CRN and KTX files).-helperThreads 15
, I get 1 different file (a DDS file).-helperThreads 3
, the image conversion is reproducible.-helperThreads 3
, the image conversion is reproducible.-helperThreads 4
, I get 6 different files (some DDS, CRN and KTX files).-helperThreads 7
, the image conversion is reproducible.-helperThreads 3
, the image conversion is reproducible.-helperThreads 4
, I get 6 different files (some DDS, CRN and KTX files).-helperThreads 8
, the image conversion is reproducible.-helperThreads 9
, I get 1 different file (a DDS file).-helperThreads 10
, I get 1 different file (a DDS file).-helperThreads 11
, the image conversion is reproducible.-helperThreads 12
, the image conversion is reproducible.-helperThreads 13
, the image conversion is reproducible.-helperThreads 14
, I get 7 different files (some DDS, CRN and KTX files).-helperThreads 15
, I get 1 different file (a DDS file).-helperThreads 16
, I get 5 different files (some DDS, CRN and KTX files).-helperThreads 17
, the image conversion is reproducible.-helperThreads 18
, the image conversion is reproducible.-helperThreads 19
, the image conversion is reproducible.-helperThreads 24
, the image conversion is reproducible.-helperThreads 30
, the image conversion is reproducible.-helperThreads 14
, I get 7 different files (some DDS, CRN and KTX files).-helperThreads 15
, I get 1 different file (a DDS file).So I suspect there is a memory corruption or memory allocation error somewhere.
When there are different images being produced, it's always the same conversion that produces something different.