Only use the adaptive level-of-detail when actually rendering out frames in a session recording (closes #1292); Remove OpenGL performance warning messages when writing frames due to expected GPU-CPU sync

This commit is contained in:
Alexander Bock
2021-05-08 19:53:40 +02:00
parent e3af4a9f09
commit abd084c0a9
2 changed files with 31 additions and 25 deletions

View File

@@ -34,6 +34,7 @@
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/interaction/sessionrecording.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scene/scene.h>
@@ -140,7 +141,8 @@ namespace {
"DynamicLodIterationCount",
"Data availability checks before LOD factor impact",
"The number of checks that have to fail/succeed in a row before the dynamic "
"level-of-detail adjusts the actual level-of-detail up or down"
"level-of-detail adjusts the actual level-of-detail up or down during a session "
"recording"
};
constexpr openspace::properties::Property::PropertyInfo PerformShadingInfo = {
@@ -1187,30 +1189,32 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
}
_localRenderer.program->deactivate();
// If our tile cache is very full, we assume we need to adjust the level of detail
// dynamically to not keep rendering frames with unavailable data
// After certain number of iterations(_debugProperties.dynamicLodIterationCount) of
// unavailable/available data in a row, we assume that a change could be made.
const int iterCount = _debugProperties.dynamicLodIterationCount;
const bool exceededIterations =
static_cast<int>(_iterationsOfUnavailableData) > iterCount;
const float clf = _generalProperties.currentLodScaleFactor;
const float clfMin = _generalProperties.currentLodScaleFactor.minValue();
const float targetLod = _generalProperties.targetLodScaleFactor;
const bool validLodFactor = clf > clfMin;
if (exceededIterations && validLodFactor) {
_generalProperties.currentLodScaleFactor =
_generalProperties.currentLodScaleFactor - 0.1f;
_iterationsOfUnavailableData = 0;
_lodScaleFactorDirty = true;
} // Make 2 times the iterations with available data to move it up again
else if (static_cast<int>(_iterationsOfAvailableData) >
(iterCount * 2) && clf < targetLod)
{
_generalProperties.currentLodScaleFactor =
_generalProperties.currentLodScaleFactor + 0.1f;
_iterationsOfAvailableData = 0;
_lodScaleFactorDirty = true;
if (global::sessionRecording->isSavingFramesDuringPlayback()) {
// If our tile cache is very full, we assume we need to adjust the level of detail
// dynamically to not keep rendering frames with unavailable data
// After certain number of iterations(_debugProperties.dynamicLodIterationCount) of
// unavailable/available data in a row, we assume that a change could be made.
const int iterCount = _debugProperties.dynamicLodIterationCount;
const bool exceededIterations =
static_cast<int>(_iterationsOfUnavailableData) > iterCount;
const float clf = _generalProperties.currentLodScaleFactor;
const float clfMin = _generalProperties.currentLodScaleFactor.minValue();
const float targetLod = _generalProperties.targetLodScaleFactor;
const bool validLodFactor = clf > clfMin;
if (exceededIterations && validLodFactor) {
_generalProperties.currentLodScaleFactor =
_generalProperties.currentLodScaleFactor - 0.1f;
_iterationsOfUnavailableData = 0;
_lodScaleFactorDirty = true;
} // Make 2 times the iterations with available data to move it up again
else if (static_cast<int>(_iterationsOfAvailableData) >
(iterCount * 2) && clf < targetLod)
{
_generalProperties.currentLodScaleFactor =
_generalProperties.currentLodScaleFactor + 0.1f;
_iterationsOfAvailableData = 0;
_lodScaleFactorDirty = true;
}
}
}

View File

@@ -234,6 +234,8 @@ OpenGLDebugContext = {
{ Type = "Other", Source = "API", Identifier = 131185 },
-- API_ID_RECOMPILE_FRAGMENT_SHADER performance warning has been generated. Fragment shader recompiled due to state change
{ Type = "Performance", Source = "API", Identifier = 2 },
-- Pixel-path performance warning: Pixel transfer is synchronized with 3D rendering
{ Type = "Performance", Source = "API", Identifier = 131154 },
-- Buffer performance warning: "copied/moved from VIDEO memory to HOST memory"
{ Type = "Performance", Source = "API", Identifier = 131186 },
-- API_ID_LINE_WIDTH deprecated behavior warning has been generated