NVIDIA / gvdb-voxels

Sparse volume compute and rendering on NVIDIA GPUs
Other
679 stars 145 forks source link

LoadVBX bug (not a SaveVBX bug) #19

Closed coreuml closed 4 years ago

coreuml commented 6 years ago

In SaveVBX function, at line 1814 if (major >= 2) { fwrite( &use_bitmask, sizeof(uchar), 1, fp ); // bitmask usage (GVDB 2.0 or higher) }

It 's not writed bitmask sign, but in LoadVBX, read this sign.

Modified: if ((major == 1 && minor >= 1) || major > 1) { fwrite( &use_bitmask, sizeof(uchar), 1, fp ); // bitmask usage (GVDB 2.0 or higher) }

ramakarl commented 5 years ago

Yes, that looks like a bug. The condition in SaveVBX is the correct one (only 2.0 and higher). If you make a pull request with LoadVBX fixed to match it then i will merge. Also, LoadVBX should say 'fread'

ramakarl commented 5 years ago

Just to clarify whats going on here.

The logic is: If 1.0.then use_bitmask=true; If 1.1 then use_bitmask=false; If >=2.0 then read/write use_bitmask to disk;

NBickford-NV commented 4 years ago

I've just pushed commit c530d1aa, which should fix this issue - it makes it so that if LoadVBX reads a version number of 2.0 or greater, then it loads use_bitmask, while if it reads a version number of 1.0, then it sets use_bitmask to true, and otherwise it sets use_bitmask to false. It also updates the VBX file specification to include these changes between different versions.