diff --git a/source/EngineGpuKernels/EditKernelsLauncher.cu b/source/EngineGpuKernels/EditKernelsLauncher.cu index 08b3a29b4..cafcc0718 100644 --- a/source/EngineGpuKernels/EditKernelsLauncher.cu +++ b/source/EngineGpuKernels/EditKernelsLauncher.cu @@ -69,7 +69,7 @@ void _EditKernelsLauncher::updateSelection(GpuSettings const& gpuSettings, Simul void _EditKernelsLauncher::getSelectionShallowData(GpuSettings const& gpuSettings, SimulationData const& data, SelectionResult const& selectionResult) { KERNEL_CALL_1_1(cudaResetSelectionResult, selectionResult); - setValueToDevice(_cudaMinCellPosYAndIndex, 0xffffffffffffffff); + setValueToDevice(_cudaMinCellPosYAndIndex, 0xffffffffffffffffull); KERNEL_CALL(cudaCalcCellWithMinimalPosY, data, _cudaMinCellPosYAndIndex); cudaDeviceSynchronize(); auto refCellIndex = static_cast(copyToHost(_cudaMinCellPosYAndIndex) & 0xffffffff); diff --git a/source/Gui/AutosaveWindow.cpp b/source/Gui/AutosaveWindow.cpp index b4f766f72..417080a7d 100644 --- a/source/Gui/AutosaveWindow.cpp +++ b/source/Gui/AutosaveWindow.cpp @@ -115,7 +115,7 @@ void AutosaveWindow::processToolbar() AlienImGui::Tooltip("Create save point"); ImGui::SameLine(); - ImGui::BeginDisabled(!static_cast(_selectedEntry) || _selectedEntry->state != SavepointState_Persisted); + ImGui::BeginDisabled(!static_cast(_selectedEntry) || (_selectedEntry->state != SavepointState_Persisted && !_selectedEntry->requestId.empty())); if (AlienImGui::ToolbarButton(ICON_FA_MINUS)) { onDeleteSavepoint(_selectedEntry); } @@ -166,6 +166,12 @@ void AutosaveWindow::processTable() // project name ImGui::TableNextColumn(); + if (entry->state == SavepointState_InQueue) { + AlienImGui::Text("In queue"); + } + if (entry->state == SavepointState_InProgress) { + AlienImGui::Text("In progress"); + } if (entry->state == SavepointState_Persisted) { auto triggerLoadSavepoint = AlienImGui::ActionButton(AlienImGui::ActionButtonParameters().buttonText(ICON_FA_DOWNLOAD)); AlienImGui::Tooltip("Load savepoint", false); @@ -176,6 +182,9 @@ void AutosaveWindow::processTable() ImGui::SameLine(); AlienImGui::Text(entry->name); } + if (entry->state == SavepointState_Error) { + AlienImGui::Text("Error"); + } ImGui::SameLine(); auto selected = _selectedEntry == entry; @@ -189,18 +198,9 @@ void AutosaveWindow::processTable() // timestamp ImGui::TableNextColumn(); - if (entry->state == SavepointState_InQueue) { - AlienImGui::Text("In queue"); - } - if (entry->state == SavepointState_InProgress) { - AlienImGui::Text("In progress"); - } if (entry->state == SavepointState_Persisted) { AlienImGui::Text(entry->timestamp); } - if (entry->state == SavepointState_Error) { - AlienImGui::Text("Error"); - } // timestep ImGui::TableNextColumn(); @@ -247,8 +247,8 @@ void AutosaveWindow::processSettings() _lastAutosaveTimepoint = std::chrono::steady_clock::now(); } } - if (AlienImGui::Combo( - AlienImGui::ComboParameters() + if (AlienImGui::Switcher( + AlienImGui::SwitcherParameters() .name("Catch peaks") .textWidth(RightColumnWidth) .defaultValue(_origCatchPeaks) @@ -266,8 +266,8 @@ void AutosaveWindow::processSettings() _directory)) { updateSavepointTableFromFile(); } - AlienImGui::Combo( - AlienImGui::ComboParameters() + AlienImGui::Switcher( + AlienImGui::SwitcherParameters() .name("Mode") .values({"Circular save files", "Unlimited save files"}) .textWidth(RightColumnWidth) @@ -444,7 +444,7 @@ void AutosaveWindow::updateSavepoint(int row) newEntry->filename = data.filename; newEntry->peak = StringHelper::format(toFloat(sumColorVector(data.rawStatisticsData.timeline.timestep.genomeComplexityVariance)), 2); newEntry->peakType = "genome complexity variance"; - _peakDeserializedSimulation->setDeserializedSimulation(DeserializedSimulation()); + _peakDeserializedSimulation->reset(); } } if (requestState.value() == PersisterRequestState::Error) { diff --git a/source/Gui/OverlayController.cpp b/source/Gui/OverlayController.cpp index a56b92c4c..889f01106 100644 --- a/source/Gui/OverlayController.cpp +++ b/source/Gui/OverlayController.cpp @@ -18,6 +18,7 @@ namespace auto constexpr ShowDuration = 800; auto constexpr FadeoutTextDuration = 800; auto constexpr FadeoutLightningDuration = 1200; + auto constexpr FadeoutProgressAnimationDuration = 1000; } void OverlayController::setup(PersisterFacade const& persisterFacade) @@ -55,11 +56,20 @@ void OverlayController::setOn(bool value) void OverlayController::processProgressAnimation() { if (_persisterFacade->isBusy()) { + _busyTimepoint = std::chrono::steady_clock::now(); + } + if (!_busyTimepoint.has_value()) { + return; + } + auto now = std::chrono::steady_clock::now(); + auto millisecSinceBusy = std::chrono::duration_cast(now - *_busyTimepoint).count(); + + if (millisecSinceBusy < FadeoutProgressAnimationDuration) { if (!_progressBarRefTimepoint.has_value()) { _progressBarRefTimepoint = std::chrono::steady_clock::now(); } - auto now = std::chrono::steady_clock::now(); auto duration = toFloat(std::chrono::duration_cast(now - *_progressBarRefTimepoint).count()); + auto alpha = 1.0f - toFloat(millisecSinceBusy) / FadeoutProgressAnimationDuration; ImDrawList* drawList = ImGui::GetBackgroundDrawList(); @@ -73,7 +83,7 @@ void OverlayController::processProgressAnimation() ImVec2{center.x, center.y + height}, ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), - ImColor::HSV(0.66f, 1.0f, 0.1f, 1.0f), + ImColor::HSV(0.66f, 1.0f, 0.1f, 1.0f * alpha), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f)); drawList->AddRectFilledMultiColor( ImVec2{center.x, center.y - height * 5}, @@ -81,11 +91,11 @@ void OverlayController::processProgressAnimation() ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), - ImColor::HSV(0.66f, 1.0f, 0.1f, 1.0f)); + ImColor::HSV(0.66f, 1.0f, 0.1f, 1.0f * alpha)); drawList->AddRectFilledMultiColor( ImVec2{center.x, center.y + height}, ImVec2{center.x + width, center.y + height * 6}, - ImColor::HSV(0.66f, 1.0f, 0.1f, 1.0f), + ImColor::HSV(0.66f, 1.0f, 0.1f, 1.0f * alpha), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f)); @@ -93,7 +103,7 @@ void OverlayController::processProgressAnimation() ImVec2{center.x - width, center.y + height}, ImVec2{center.x, center.y + height * 6}, ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), - ImColor::HSV(0.66f, 1.0f, 0.1f, 1.0f), + ImColor::HSV(0.66f, 1.0f, 0.1f, 1.0f * alpha), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f), ImColor::HSV(0.66f, 1.0f, 0.1f, 0.0f)); auto N = 8 + toInt(powf(sinf(duration / 500.0f - Const::Pi / 4) + 1, 3.0f) * 5); @@ -107,18 +117,19 @@ void OverlayController::processProgressAnimation() drawList->AddRectFilled( ImVec2{center.x - width / 2 + toFloat(i) / N * width, std::min(y1, y2)}, ImVec2{center.x - width / 2 + toFloat(i + 1) / N * width - scale(3), std::max(y1, y2)}, - ImColor::HSV(0.625f, 0.8f, 0.55f, 0.6f)); + ImColor::HSV(0.625f, 0.8f, 0.45f, 0.7f * alpha)); } drawList->AddText( StyleRepository::get().getReefMediumFont(), scale(16.0f), {center.x - scale(28.0f), center.y - scale(15.0f)}, - ImColor::HSV(0, 0, 1, 0.7f), + ImColor::HSV(0, 0, 1, 0.7f * alpha), "Processing"); } else { _progressBarRefTimepoint.reset(); + _busyTimepoint.reset(); } } diff --git a/source/Gui/OverlayController.h b/source/Gui/OverlayController.h index c49a20c5d..932cb30ca 100644 --- a/source/Gui/OverlayController.h +++ b/source/Gui/OverlayController.h @@ -33,6 +33,7 @@ class OverlayController std::optional _progressBarRefTimepoint; std::optional _messageStartTimepoint; std::optional _ticksLaterTimepoint; + std::optional _busyTimepoint; }; inline void printOverlayMessage(std::string const& message, bool withLightning = false) diff --git a/source/PersisterInterface/SharedDeserializedSimulation.h b/source/PersisterInterface/SharedDeserializedSimulation.h index ec4b847e9..552a271bd 100644 --- a/source/PersisterInterface/SharedDeserializedSimulation.h +++ b/source/PersisterInterface/SharedDeserializedSimulation.h @@ -39,6 +39,12 @@ class _SharedDeserializedSimulation return _timestamp; } + void reset() + { + setDeserializedSimulation(DeserializedSimulation()); + setLastStatisticsData(RawStatisticsData()); + } + bool isEmpty() const { std::lock_guard lock(_mutex);