Quote:
When the whole region cannot be prefetched maybe it's best to just prefetch as much as possible? I doubt if this will happen much anyway - I imagine the prefetching is used on fairly small regions.
actually that is what happens. since I'm shifting to block coordinates, I end up getting more voxels than anticipated if someone enters not exact block begin and end coordinates for the region.
Quote:
I guess you just see the TODO as an optimisation, right? Because the blocks will get unloaded anyway as new ones are loaded
yes, I did not implement it for the same reason you posted later... keeping it simple.
Quote:
Is it useful to return the number of blocks flushed? It's kind of an implementation detail and I'm not sure what the user would do with this information. And what is the purpose of 'm_uBlockSideLengthPower*3'?
I didn't say number of blocks, I said number of voxels.
shifting by m_uBlockSideLengthPower*3 is the same as multiplying by the number of voxels in a block.
I'm not sure what one would do with it except to test for != 0, so we could also return a boolean if you prefer.
Quote:
Actually, I would argue that it's normally not in there (unless I misunderstand). Leaving aside the prefetch/flush, the usual reason why eraseBlock is called is because the block is so old that it is being removed. If it's old then it should have been taken out the uncompressed cache long ago. Maybe we need more than one eraseBlock function here.
nope it's in there. we just tried to save it, for saving the user *may* access it, increasing the timestamp and making sure it's back in the uncompressed cache.
so the ideal fix is:
1. give the block directly to ConstVolumeProxy, removing all calls to getUncompressed Block
2. uncompressing it manually in ConstVolumeProxy if necessary (without adding to the uncompressed cache)
3. forcing the uncompressed cache to be smaller than the paging cache at all times.
4. creating a second erase function just for the flush function.
Quote:
In the case of 'setMaxNumberOfBlocksInMemory' I think a complete flush would be easier and safer (as you say, it will probably only be called at the start). I feel we are starting to develop some complexity in this class now, so I'd rather keep everything easy and safe rather than risk bugs.
okay lets do that. and warn the user in the docs that this function should only be called at the beginning.
Quote:
Ok, I've applied the patch. A couple of small points though - maybe just 'prefetch' and 'flush' is enough rather than 'prefetchRegion' and 'flushRegion'.
sure, there isn't anything else that's supposed to be flushed/prefetched anyway
Quote:
Also I always use brackets even for one line for loops or if statements, and I place them on their own line. I guess you like your code to look compact, whereas I tend to spread mine out
jop, if you want my additions to polyvox to look your way I can do that from now on.
it's probably better if it's consistent