diff --git a/ext/ghoul b/ext/ghoul index e9cb5d37ff..c342cf9d25 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit e9cb5d37ff38bc93b95a96a65146385a9e42e341 +Subproject commit c342cf9d25995b02e709fc4bcc114ef40a3a8715 diff --git a/modules/atmosphere/rendering/atmospheredeferredcaster.cpp b/modules/atmosphere/rendering/atmospheredeferredcaster.cpp index 376b8db702..48bf03d06b 100644 --- a/modules/atmosphere/rendering/atmospheredeferredcaster.cpp +++ b/modules/atmosphere/rendering/atmospheredeferredcaster.cpp @@ -150,6 +150,8 @@ namespace { namespace openspace { void AtmosphereDeferredcaster::initialize() { + ZoneScoped + if (!_atmosphereCalculated) { preCalculateAtmosphereParam(); } @@ -159,6 +161,8 @@ void AtmosphereDeferredcaster::initialize() { } void AtmosphereDeferredcaster::deinitialize() { + ZoneScoped + _transmittanceProgramObject = nullptr; _irradianceProgramObject = nullptr; _irradianceSupTermsProgramObject = nullptr; diff --git a/modules/base/lightsource/scenegraphlightsource.cpp b/modules/base/lightsource/scenegraphlightsource.cpp index 628b8586bd..4d2432fad9 100644 --- a/modules/base/lightsource/scenegraphlightsource.cpp +++ b/modules/base/lightsource/scenegraphlightsource.cpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace { constexpr openspace::properties::Property::PropertyInfo IntensityInfo = { @@ -115,6 +116,8 @@ SceneGraphLightSource::SceneGraphLightSource(const ghoul::Dictionary& dictionary } bool SceneGraphLightSource::initialize() { + ZoneScoped + _sceneGraphNode = global::renderEngine.scene()->sceneGraphNode(_sceneGraphNodeReference); return _sceneGraphNode != nullptr; diff --git a/modules/base/rendering/modelgeometry.cpp b/modules/base/rendering/modelgeometry.cpp index d597230d9f..f6a339711c 100644 --- a/modules/base/rendering/modelgeometry.cpp +++ b/modules/base/rendering/modelgeometry.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -118,6 +119,8 @@ void ModelGeometry::changeRenderMode(GLenum mode) { } bool ModelGeometry::initialize(Renderable* parent) { + ZoneScoped + float maximumDistanceSquared = 0; for (const Vertex& v : _vertices) { maximumDistanceSquared = glm::max( diff --git a/modules/base/rendering/renderablelabels.cpp b/modules/base/rendering/renderablelabels.cpp index f9f9c4958c..9ad0172359 100644 --- a/modules/base/rendering/renderablelabels.cpp +++ b/modules/base/rendering/renderablelabels.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -604,6 +605,8 @@ bool RenderableLabels::isReady() const { } void RenderableLabels::initialize() { + ZoneScoped + bool success = true;// loadData(); if (!success) { throw ghoul::RuntimeError("Error loading objects labels data."); diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index 957eae6e92..26b592797a 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -37,8 +37,9 @@ #include #include -#include #include +#include +#include #include #include #include @@ -294,12 +295,16 @@ bool RenderableModel::isReady() const { } void RenderableModel::initialize() { + ZoneScoped + for (const std::unique_ptr& ls : _lightSources) { ls->initialize(); } } void RenderableModel::initializeGL() { + ZoneScoped + _program = BaseModule::ProgramObjectManager.request( ProgramName, []() -> std::unique_ptr { diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index ed57c6830d..102cf6f5ee 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -282,6 +282,8 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary) } void RenderableTrail::initializeGL() { + ZoneScoped + #ifdef __APPLE__ _programObject = BaseModule::ProgramObjectManager.request( ProgramName, diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp index 5a9a07e5fd..6ebf88d97c 100644 --- a/modules/base/rotation/fixedrotation.cpp +++ b/modules/base/rotation/fixedrotation.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include namespace { @@ -444,6 +445,8 @@ FixedRotation::FixedRotation(const ghoul::Dictionary& dictionary) } bool FixedRotation::initialize() { + ZoneScoped + // We need to do this in the initialize and not the constructor as the scene graph // nodes referenced in the dictionary might not exist yet at construction time. At // initialization time, however, we know that they already have been created diff --git a/modules/digitaluniverse/rendering/renderablepoints.cpp b/modules/digitaluniverse/rendering/renderablepoints.cpp index d48ddd9313..7b5bca997f 100644 --- a/modules/digitaluniverse/rendering/renderablepoints.cpp +++ b/modules/digitaluniverse/rendering/renderablepoints.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -235,6 +236,8 @@ bool RenderablePoints::isReady() const { } void RenderablePoints::initialize() { + ZoneScoped + bool success = loadData(); if (!success) { throw ghoul::RuntimeError("Error loading data"); @@ -242,6 +245,8 @@ void RenderablePoints::initialize() { } void RenderablePoints::initializeGL() { + ZoneScoped + // OBS: The ProgramObject name is later used to release the program as well, so the // name parameter to requestProgramObject and the first parameter to // buildRenderProgram has to be the same or an assertion will be thrown at the diff --git a/modules/galaxy/rendering/galaxyraycaster.cpp b/modules/galaxy/rendering/galaxyraycaster.cpp index 076662d73c..3faa00b483 100644 --- a/modules/galaxy/rendering/galaxyraycaster.cpp +++ b/modules/galaxy/rendering/galaxyraycaster.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,8 @@ GalaxyRaycaster::GalaxyRaycaster(ghoul::opengl::Texture& texture) {} void GalaxyRaycaster::initialize() { + ZoneScoped + _boundingBox.initialize(); } diff --git a/modules/galaxy/rendering/renderablegalaxy.cpp b/modules/galaxy/rendering/renderablegalaxy.cpp index b86e9393f4..1c140a8b0b 100644 --- a/modules/galaxy/rendering/renderablegalaxy.cpp +++ b/modules/galaxy/rendering/renderablegalaxy.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -353,6 +354,8 @@ RenderableGalaxy::RenderableGalaxy(const ghoul::Dictionary& dictionary) } void RenderableGalaxy::initialize() { + ZoneScoped + // Aspect is currently hardcoded to cubic voxels. _aspect = static_cast(_volumeDimensions); _aspect /= std::max(std::max(_aspect.x, _aspect.y), _aspect.z); @@ -409,6 +412,8 @@ void RenderableGalaxy::initialize() { } void RenderableGalaxy::initializeGL() { + ZoneScoped + _texture = std::make_unique( _volumeDimensions, ghoul::opengl::Texture::Format::RGBA, diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index 666b942143..5f091b8108 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -44,6 +44,8 @@ namespace openspace::globebrowsing::luascriptfunctions { * Adds a layer to the specified globe. */ int addLayer(lua_State* L) { + ZoneScoped + ghoul::lua::checkArgumentsAndThrow(L, 3, "lua::addLayer"); // String arguments diff --git a/modules/globebrowsing/src/asynctiledataprovider.cpp b/modules/globebrowsing/src/asynctiledataprovider.cpp index 45e4fbe84b..e6795dc4df 100644 --- a/modules/globebrowsing/src/asynctiledataprovider.cpp +++ b/modules/globebrowsing/src/asynctiledataprovider.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include namespace openspace::globebrowsing { @@ -45,6 +46,8 @@ AsyncTileDataProvider::AsyncTileDataProvider(std::string name, , _rawTileDataReader(std::move(rawTileDataReader)) , _concurrentJobManager(LRUThreadPool(1, 10)) { + ZoneScoped + _globeBrowsingModule = global::moduleEngine.module(); performReset(ResetRawTileDataReader::No); } @@ -187,6 +190,8 @@ bool AsyncTileDataProvider::shouldBeDeleted() { } void AsyncTileDataProvider::performReset(ResetRawTileDataReader resetRawTileDataReader) { + ZoneScoped + ghoul_assert(_enqueuedTileRequests.empty(), "No enqueued requests left"); // Reset raw tile data reader diff --git a/modules/globebrowsing/src/globelabelscomponent.cpp b/modules/globebrowsing/src/globelabelscomponent.cpp index 28c9b60409..a603733eaf 100644 --- a/modules/globebrowsing/src/globelabelscomponent.cpp +++ b/modules/globebrowsing/src/globelabelscomponent.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -322,6 +323,8 @@ GlobeLabelsComponent::GlobeLabelsComponent() void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary, globebrowsing::RenderableGlobe* globe) { + ZoneScoped + documentation::testSpecificationAndThrow( Documentation(), dictionary, diff --git a/modules/globebrowsing/src/layer.cpp b/modules/globebrowsing/src/layer.cpp index d4a049be46..d9bdc6b8ec 100644 --- a/modules/globebrowsing/src/layer.cpp +++ b/modules/globebrowsing/src/layer.cpp @@ -374,6 +374,8 @@ Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict, } void Layer::initialize() { + ZoneScoped + if (_tileProvider) { tileprovider::initialize(*_tileProvider); } diff --git a/modules/globebrowsing/src/layergroup.cpp b/modules/globebrowsing/src/layergroup.cpp index 260594489f..ca175a1658 100644 --- a/modules/globebrowsing/src/layergroup.cpp +++ b/modules/globebrowsing/src/layergroup.cpp @@ -114,6 +114,8 @@ int LayerGroup::update() { } Layer* LayerGroup::addLayer(const ghoul::Dictionary& layerDict) { + ZoneScoped + documentation::TestResult res = documentation::testSpecification( Layer::Documentation(), layerDict diff --git a/modules/globebrowsing/src/rawtiledatareader.cpp b/modules/globebrowsing/src/rawtiledatareader.cpp index 4b1db96cbb..4463afb88b 100644 --- a/modules/globebrowsing/src/rawtiledatareader.cpp +++ b/modules/globebrowsing/src/rawtiledatareader.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef _MSC_VER #pragma warning (push) @@ -423,6 +424,8 @@ RawTileDataReader::RawTileDataReader(std::string filePath, , _initData(std::move(initData)) , _preprocess(preprocess) { + ZoneScoped + initialize(); } @@ -435,6 +438,8 @@ RawTileDataReader::~RawTileDataReader() { } void RawTileDataReader::initialize() { + ZoneScoped + if (_datasetFilePath.empty()) { throw ghoul::RuntimeError("File path must not be empty"); } @@ -443,6 +448,7 @@ void RawTileDataReader::initialize() { std::string content = _datasetFilePath; if (module.isWMSCachingEnabled()) { + ZoneScopedN("WMS Caching") std::string c; if (FileSys.fileExists(_datasetFilePath)) { // Only replace the 'content' if the dataset is an XML file and we want to do @@ -511,16 +517,19 @@ void RawTileDataReader::initialize() { } } - _dataset = static_cast(GDALOpen(content.c_str(), GA_ReadOnly)); - if (!_dataset) { - throw ghoul::RuntimeError("Failed to load dataset: " + _datasetFilePath); + { + ZoneScopedN("GDALOpen") + _dataset = static_cast(GDALOpen(content.c_str(), GA_ReadOnly)); + if (!_dataset) { + throw ghoul::RuntimeError("Failed to load dataset: " + _datasetFilePath); + } } // Assume all raster bands have the same data type _rasterCount = _dataset->GetRasterCount(); // calculateTileDepthTransform - unsigned long long maximumValue = [t = _initData.glType]() { + unsigned long long maximumValue = [](GLenum t) { switch (t) { case GL_UNSIGNED_BYTE: return 1ULL << 8ULL; case GL_UNSIGNED_SHORT: return 1ULL << 16ULL; @@ -530,11 +539,9 @@ void RawTileDataReader::initialize() { case GL_HALF_FLOAT: return 1ULL; case GL_FLOAT: return 1ULL; case GL_DOUBLE: return 1ULL; - default: - ghoul_assert(false, "Unknown data type"); - throw ghoul::MissingCaseException(); + default: throw ghoul::MissingCaseException(); } - }(); + }(_initData.glType); _depthTransform.scale = static_cast( @@ -554,7 +561,8 @@ void RawTileDataReader::initialize() { } double tileLevelDifference = calculateTileLevelDifference( - _dataset, _initData.dimensions.x + _dataset, + _initData.dimensions.x ); const int numOverviews = _dataset->GetRasterBand(1)->GetOverviewCount(); diff --git a/modules/globebrowsing/src/ringscomponent.cpp b/modules/globebrowsing/src/ringscomponent.cpp index 19ef939018..6cec19f313 100644 --- a/modules/globebrowsing/src/ringscomponent.cpp +++ b/modules/globebrowsing/src/ringscomponent.cpp @@ -198,6 +198,8 @@ RingsComponent::RingsComponent(const ghoul::Dictionary& dictionary) } void RingsComponent::initialize() { + ZoneScoped + using ghoul::filesystem::File; addProperty(_enabled); @@ -257,6 +259,8 @@ bool RingsComponent::isReady() const { } void RingsComponent::initializeGL() { + ZoneScoped + compileShadowShader(); try { diff --git a/modules/globebrowsing/src/shadowcomponent.cpp b/modules/globebrowsing/src/shadowcomponent.cpp index c615d3a64b..598cf1fc3a 100644 --- a/modules/globebrowsing/src/shadowcomponent.cpp +++ b/modules/globebrowsing/src/shadowcomponent.cpp @@ -227,6 +227,8 @@ bool ShadowComponent::isReady() const { } void ShadowComponent::initializeGL() { + ZoneScoped + createDepthTexture(); createShadowFBO(); } diff --git a/modules/globebrowsing/src/tileprovider.cpp b/modules/globebrowsing/src/tileprovider.cpp index 1b7686a322..3e57d400d3 100644 --- a/modules/globebrowsing/src/tileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider.cpp @@ -824,6 +824,13 @@ bool initialize(TileProvider& tp) { ghoul_assert(!tp.isInitialized, "TileProvider can only be initialized once."); + if (TileProvider::NumTileProviders > std::numeric_limits::max()) { + LERRORC( + "TileProvider", + "Number of tile providers exceeds 65535. Something will break soon" + ); + TileProvider::NumTileProviders = 0; + } tp.uniqueIdentifier = TileProvider::NumTileProviders++; if (TileProvider::NumTileProviders == std::numeric_limits::max()) { --TileProvider::NumTileProviders; diff --git a/modules/globebrowsing/src/tileprovider.h b/modules/globebrowsing/src/tileprovider.h index 8f6bcd4772..909380f0a0 100644 --- a/modules/globebrowsing/src/tileprovider.h +++ b/modules/globebrowsing/src/tileprovider.h @@ -76,7 +76,7 @@ struct TileProvider : public properties::PropertyOwner { std::string name; - unsigned int uniqueIdentifier = 0; + uint16_t uniqueIdentifier = 0; bool isInitialized = false; }; diff --git a/src/rendering/framebufferrenderer.cpp b/src/rendering/framebufferrenderer.cpp index ab9512c6c0..e637d25e42 100644 --- a/src/rendering/framebufferrenderer.cpp +++ b/src/rendering/framebufferrenderer.cpp @@ -161,6 +161,8 @@ namespace { namespace openspace { void FramebufferRenderer::initialize() { + ZoneScoped + LDEBUG("Initializing FramebufferRenderer"); HasGLDebugInfo = glbinding::Binding::ObjectLabel.isResolved() && diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index f93a278a6b..80e892309f 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -43,6 +43,8 @@ AssetManager::AssetManager(ghoul::lua::LuaState* state, std::string assetRootDir {} void AssetManager::initialize() { + ZoneScoped + _assetLoader.addAssetListener(this); _assetLoader.rootAsset().initialize(); }