Patch and Optimisation
Release 0.12.11
General fixes and improvement
- Update
SIMPLEto version 3.0. - Fix an incorrect use of comma operator during initialisation of
const SIStorage&inSTPStartwhich creates unnecessary data copies. - Fix an incorrect use of
inlinein the following files which causes link-time undefined reference when compile under Release build:STPSmartDeviceMemorySTPScreenSTPScenePipeline
- For
STPShaderManager, improve shader macro defining withstd::string_view. Add support for detecting#definewith leading and in-between white space. - All use of
std::queueare changed to usestd::dequeas container instead ofstd::list. - Deprecate and remove
STPChunkStoragebecause it is just a useless thin wrapper overstd::unordered_map. - Change the declaration order for
STPThreadPoolinSTPWorldPipelineandSTPSingleHistogramFilterto ensure the correct destruction order and avoid illegal memory access. - For
STPOpenGL.h,STPuint64is now expressed asuint64_tto make it compatible with system which uses different specification to defineGLuint64. - Fix an error on some compilers where:
sqrt()is not found inSTPErosionBrushGeneratorby including correspond math header.memsetis not found inSTPLayerCacheby including cstring.std::shuffleis not found inSTPPermutationGeneratorby including algorithm.std::listis not found inSTPShaderManagerandSTPThreadPool.
- Remove useless
typenamedeclaration which causes errors for some compilers, from:STPSmartDeviceMemory.tppSTPMemoryPool.hSTPFreeSlipTextureBuffer.handSTPFreeSlipTextureBuffer.cppSTPSingleHistogramFilter.cppSTPSceneObject.h
- Remove extra namespace qualification for some functions in
STPScenePipeline. - Launch buffer size in
STPBiomefieldGeneratorandSTPSplatmapGeneratornow usessizeofto determine rather than using hardcoded values because pointer size on different platform might not be always 8 byte.
STPWorldPipeline
- Fix an undefined behaviour where a temporay returned vector is used in a range-based for loop.
- Fix a race condition where chunk might be used while it is being occupied.
To avoid running into the nasty race condition again, we introduce STPChunk::STPMapVisitor which has two operation modes: shared and unique. It works like a shared/unique mutex in the standard library, the only difference is rather than stalling threads when mutex condition is unmet, exception will be generated. This attempts to prevent developers from making this mistake in the future again.
STPTextureDefinitionLanguage
- Fix a bug where a
std::stringis created from calling thedata()function instd::string_viewwhich basically copies the entire chunk of memory for every number parsed and results in significant memory overhead. - Simplify
readNumber()andreadString()functions. Remove repeated string read.