Merge branch 'develop' into feature/custom-chunk-hash-table
This commit is contained in:
commit
5dd46c4bcf
@ -56,13 +56,12 @@ namespace PolyVox
|
|||||||
m_strFolderName.append("/");
|
m_strFolderName.append("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build a unique prefix to avoid multiple pagers using the same filenames.
|
// Build a unique postfix to avoid filename conflicts between multiple pagers/runs.
|
||||||
srand(static_cast<unsigned int>(time(0)));
|
// Not a very robust solution but this class is meant as an example for testing really.
|
||||||
int iRandomValue = rand();
|
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << std::hex << iRandomValue;
|
ss << time(0) << "--"; // Avoid multiple runs using the same filenames.
|
||||||
m_strRandomPrefix = ss.str();
|
ss << this; // Avoid multiple FilePagers using the same filenames.
|
||||||
|
m_strPostfix = ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
@ -82,9 +81,10 @@ namespace PolyVox
|
|||||||
POLYVOX_ASSERT(pChunk->getData(), "Chunk must have valid data");
|
POLYVOX_ASSERT(pChunk->getData(), "Chunk must have valid data");
|
||||||
|
|
||||||
std::stringstream ssFilename;
|
std::stringstream ssFilename;
|
||||||
ssFilename << m_strFolderName << "/" << m_strRandomPrefix << "-"
|
ssFilename << m_strFolderName << "/"
|
||||||
<< region.getLowerX() << "_" << region.getLowerY() << "_" << region.getLowerZ() << "_"
|
<< region.getLowerX() << "_" << region.getLowerY() << "_" << region.getLowerZ() << "_"
|
||||||
<< region.getUpperX() << "_" << region.getUpperY() << "_" << region.getUpperZ();
|
<< region.getUpperX() << "_" << region.getUpperY() << "_" << region.getUpperZ()
|
||||||
|
<< "--" << m_strPostfix;
|
||||||
|
|
||||||
std::string filename = ssFilename.str();
|
std::string filename = ssFilename.str();
|
||||||
|
|
||||||
@ -133,9 +133,10 @@ namespace PolyVox
|
|||||||
POLYVOX_LOG_TRACE("Paging out data for " << region);
|
POLYVOX_LOG_TRACE("Paging out data for " << region);
|
||||||
|
|
||||||
std::stringstream ssFilename;
|
std::stringstream ssFilename;
|
||||||
ssFilename << m_strFolderName << "/" << m_strRandomPrefix << "-"
|
ssFilename << m_strFolderName << "/"
|
||||||
<< region.getLowerX() << "_" << region.getLowerY() << "_" << region.getLowerZ() << "_"
|
<< region.getLowerX() << "_" << region.getLowerY() << "_" << region.getLowerZ() << "_"
|
||||||
<< region.getUpperX() << "_" << region.getUpperY() << "_" << region.getUpperZ();
|
<< region.getUpperX() << "_" << region.getUpperY() << "_" << region.getUpperZ()
|
||||||
|
<< "--" << m_strPostfix;
|
||||||
|
|
||||||
std::string filename = ssFilename.str();
|
std::string filename = ssFilename.str();
|
||||||
|
|
||||||
@ -163,7 +164,7 @@ namespace PolyVox
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_strFolderName;
|
std::string m_strFolderName;
|
||||||
std::string m_strRandomPrefix;
|
std::string m_strPostfix;
|
||||||
|
|
||||||
std::vector<std::string> m_vecCreatedFiles;
|
std::vector<std::string> m_vecCreatedFiles;
|
||||||
};
|
};
|
||||||
|
@ -225,7 +225,7 @@ int32_t testDirectRandomAccess(const VolumeType* volume)
|
|||||||
std::mt19937 rng;
|
std::mt19937 rng;
|
||||||
int32_t result = 0;
|
int32_t result = 0;
|
||||||
|
|
||||||
for (uint32_t ct = 0; ct < 10000; ct++)
|
for (uint32_t ct = 0; ct < 1000000; ct++)
|
||||||
{
|
{
|
||||||
uint32_t rand = rng();
|
uint32_t rand = rng();
|
||||||
|
|
||||||
@ -258,10 +258,12 @@ TestVolume::TestVolume()
|
|||||||
m_regExternal.shiftUpperCorner(2, 5, 4);
|
m_regExternal.shiftUpperCorner(2, 5, 4);
|
||||||
|
|
||||||
m_pFilePager = new FilePager<int32_t>(".");
|
m_pFilePager = new FilePager<int32_t>(".");
|
||||||
|
m_pFilePagerHighMem = new FilePager<int32_t>(".");
|
||||||
|
|
||||||
//Create the volumes
|
//Create the volumes
|
||||||
m_pRawVolume = new RawVolume<int32_t>(m_regVolume);
|
m_pRawVolume = new RawVolume<int32_t>(m_regVolume);
|
||||||
m_pPagedVolume = new PagedVolume<int32_t>(m_pFilePager, 1 * 1024 * 1024, m_uChunkSideLength);
|
m_pPagedVolume = new PagedVolume<int32_t>(m_pFilePager, 1 * 1024 * 1024, m_uChunkSideLength);
|
||||||
|
m_pPagedVolumeHighMem = new PagedVolume<int32_t>(m_pFilePagerHighMem, 256 * 1024 * 1024, m_uChunkSideLength);
|
||||||
|
|
||||||
//Fill the volume with some data
|
//Fill the volume with some data
|
||||||
for (int z = m_regVolume.getLowerZ(); z <= m_regVolume.getUpperZ(); z++)
|
for (int z = m_regVolume.getLowerZ(); z <= m_regVolume.getUpperZ(); z++)
|
||||||
@ -273,11 +275,11 @@ TestVolume::TestVolume()
|
|||||||
int32_t value = x + y + z;
|
int32_t value = x + y + z;
|
||||||
m_pRawVolume->setVoxel(x, y, z, value);
|
m_pRawVolume->setVoxel(x, y, z, value);
|
||||||
m_pPagedVolume->setVoxel(x, y, z, value);
|
m_pPagedVolume->setVoxel(x, y, z, value);
|
||||||
|
m_pPagedVolumeHighMem->setVoxel(x, y, z, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note - We are reusing the FilePager for testing... watch out for conflicts with the main volume.
|
|
||||||
m_pPagedVolumeChunk = new PagedVolume<uint32_t>::Chunk(Vector3DInt32(10000, 10000, 10000), m_uChunkSideLength, nullptr);
|
m_pPagedVolumeChunk = new PagedVolume<uint32_t>::Chunk(Vector3DInt32(10000, 10000, 10000), m_uChunkSideLength, nullptr);
|
||||||
std::mt19937 rng;
|
std::mt19937 rng;
|
||||||
for (uint16_t z = 0; z < m_uChunkSideLength; z++)
|
for (uint16_t z = 0; z < m_uChunkSideLength; z++)
|
||||||
@ -488,7 +490,7 @@ void TestVolume::testRawVolumeDirectRandomAccess()
|
|||||||
{
|
{
|
||||||
result = testDirectRandomAccess(m_pRawVolume);
|
result = testDirectRandomAccess(m_pRawVolume);
|
||||||
}
|
}
|
||||||
QCOMPARE(result, static_cast<int32_t>(805464457));
|
QCOMPARE(result, static_cast<int32_t>(267192737));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestVolume::testPagedVolumeDirectRandomAccess()
|
void TestVolume::testPagedVolumeDirectRandomAccess()
|
||||||
@ -496,9 +498,9 @@ void TestVolume::testPagedVolumeDirectRandomAccess()
|
|||||||
int32_t result = 0;
|
int32_t result = 0;
|
||||||
QBENCHMARK
|
QBENCHMARK
|
||||||
{
|
{
|
||||||
result = testDirectRandomAccess(m_pPagedVolume);
|
result = testDirectRandomAccess(m_pPagedVolumeHighMem);
|
||||||
}
|
}
|
||||||
QCOMPARE(result, static_cast<int32_t>(805464457));
|
QCOMPARE(result, static_cast<int32_t>(267192737));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t TestVolume::testPagedVolumeChunkAccess(uint16_t localityMask)
|
int32_t TestVolume::testPagedVolumeChunkAccess(uint16_t localityMask)
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
PolyVox::Region m_regInternal;
|
PolyVox::Region m_regInternal;
|
||||||
PolyVox::Region m_regExternal;
|
PolyVox::Region m_regExternal;
|
||||||
PolyVox::FilePager<int32_t>* m_pFilePager;
|
PolyVox::FilePager<int32_t>* m_pFilePager;
|
||||||
|
PolyVox::FilePager<int32_t>* m_pFilePagerHighMem;
|
||||||
|
|
||||||
PolyVox::RawVolume<int32_t>* m_pRawVolume;
|
PolyVox::RawVolume<int32_t>* m_pRawVolume;
|
||||||
PolyVox::PagedVolume<int32_t>* m_pPagedVolume;
|
PolyVox::PagedVolume<int32_t>* m_pPagedVolume;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user