From 9056bede7a3ad1d96214260fd0799cd91e333318 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Wed, 26 Apr 2023 17:03:41 +0800 Subject: [PATCH 1/3] Fix a segfault where prop can be unsynchronized --- .../Rendering/vtkF3DRenderPass.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/library/VTKExtensions/Rendering/vtkF3DRenderPass.cxx b/library/VTKExtensions/Rendering/vtkF3DRenderPass.cxx index ceee6a3c10..918da7da8c 100644 --- a/library/VTKExtensions/Rendering/vtkF3DRenderPass.cxx +++ b/library/VTKExtensions/Rendering/vtkF3DRenderPass.cxx @@ -68,14 +68,7 @@ void vtkF3DRenderPass::ReleaseGraphicsResources(vtkWindow* w) // ---------------------------------------------------------------------------- void vtkF3DRenderPass::Initialize(const vtkRenderState* s) { - if (this->InitializeTime == this->MTime) - { - // already initialized - return; - } - - this->ReleaseGraphicsResources(s->GetRenderer()->GetRenderWindow()); - + // Always updates props from the renderstate this->BackgroundProps.clear(); this->MainProps.clear(); @@ -94,6 +87,14 @@ void vtkF3DRenderPass::Initialize(const vtkRenderState* s) } } + if (this->InitializeTime == this->MTime) + { + // already initialized + return; + } + + this->ReleaseGraphicsResources(s->GetRenderer()->GetRenderWindow()); + // background pass, setup framebuffer, clear and draw skybox vtkNew bgP; vtkNew bgCamP; From 317fd62411d7eff388580eb0b37c0d88467b9b45 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Wed, 26 Apr 2023 17:04:17 +0800 Subject: [PATCH 2/3] Add a testing framework to test progress bar correctly --- application/testing/CMakeLists.txt | 10 +++++++--- library/src/loader_impl.cxx | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/application/testing/CMakeLists.txt b/application/testing/CMakeLists.txt index 0990908e19..cb4cef5242 100644 --- a/application/testing/CMakeLists.txt +++ b/application/testing/CMakeLists.txt @@ -1,7 +1,7 @@ # F3D Testing function(f3d_test) - cmake_parse_arguments(F3D_TEST "DEFAULT_LIGHTS;LONG_TIMEOUT;HDRI;INTERACTION;NO_BASELINE;NO_RENDER;NO_OUTPUT;WILL_FAIL" "NAME;CONFIG;DATA;RESOLUTION;THRESHOLD;REGEXP;REGEXP_FAIL;DEPENDS" "ARGS" ${ARGN}) + cmake_parse_arguments(F3D_TEST "DEFAULT_LIGHTS;LONG_TIMEOUT;HDRI;INTERACTION;NO_BASELINE;NO_RENDER;NO_OUTPUT;WILL_FAIL;FORCE_PROGRESS_BAR" "NAME;CONFIG;DATA;RESOLUTION;THRESHOLD;REGEXP;REGEXP_FAIL;DEPENDS" "ARGS" ${ARGN}) if(F3D_TEST_CONFIG) list(APPEND F3D_TEST_ARGS "--config=${F3D_TEST_CONFIG}") @@ -94,6 +94,10 @@ function(f3d_test) set_tests_properties(f3d::${F3D_TEST_NAME} PROPERTIES FIXTURES_REQUIRED f3d::${F3D_TEST_DEPENDS}_FIXTURE) endif() + if(F3D_TEST_FORCE_PROGRESS_BAR) + set_tests_properties(f3d::${F3D_TEST_NAME} PROPERTIES ENVIRONMENT "CTEST_PROGRESS_BAR_TESTING=1") + endif() + endfunction() f3d_test(NAME TestPLY DATA suzanne.ply DEFAULT_LIGHTS) @@ -496,8 +500,8 @@ f3d_test(NAME TestInteractionRecord DATA cow.vtp ARGS --interaction-test-record= f3d_test(NAME TestInteractionPlay DATA cow.vtp ARGS --interaction-test-play=${CMAKE_BINARY_DIR}/Testing/Temporary/interaction.log DEPENDS TestInteractionRecord NO_BASELINE) # Progress test -f3d_test(NAME TestProgress DATA cow.vtp ARGS --progress NO_BASELINE) -f3d_test(NAME TestProgressScene DATA world.obj ARGS --progress NO_BASELINE) +f3d_test(NAME TestProgress DATA cow.vtp ARGS --progress NO_BASELINE FORCE_PROGRESS_BAR) +f3d_test(NAME TestProgressScene DATA world.obj ARGS --progress NO_BASELINE FORCE_PROGRESS_BAR) # Window position test f3d_test(NAME TestPosition DATA dragon.vtu ARGS --position=100,100 NO_BASELINE) diff --git a/library/src/loader_impl.cxx b/library/src/loader_impl.cxx index 99d4e726ca..a85896a3d9 100644 --- a/library/src/loader_impl.cxx +++ b/library/src/loader_impl.cxx @@ -47,7 +47,8 @@ class loader_impl::internals progressData->timer->StopTimer(); vtkProgressBarWidget* widget = progressData->widget; // Only show and render the progress bar if loading takes more than 0.15 seconds - if (progressData->timer->GetElapsedTime() > 0.15) + if (progressData->timer->GetElapsedTime() > 0.15 || + vtksys::SystemTools::HasEnv("CTEST_PROGRESS_BAR_TESTING")) { widget->On(); vtkProgressBarRepresentation* rep = From 44253f61e0eb83492b219a70a5b3c422caecb137 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Wed, 26 Apr 2023 17:22:06 +0800 Subject: [PATCH 3/3] Adding a test --- application/testing/CMakeLists.txt | 9 ++--- .../TestInteractionProgressReload.log | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 testing/recordings/TestInteractionProgressReload.log diff --git a/application/testing/CMakeLists.txt b/application/testing/CMakeLists.txt index cb4cef5242..31c2324077 100644 --- a/application/testing/CMakeLists.txt +++ b/application/testing/CMakeLists.txt @@ -468,6 +468,11 @@ f3d_test(NAME TestInteractionLoadParentDirectory DATA multi/dragon.vtu ARGS --fi f3d_test(NAME TestInteractionEmptyLoadParentDirectory INTERACTION NO_BASELINE REGEXP "No file loaded, no rendering performed") #Down; f3d_test(NAME TestInteractionGroupGeometriesLoadParentDirectory DATA mb/mb_0_0.vtu ARGS --group-geometries --filename INTERACTION DEFAULT_LIGHTS) #Down; +# Progress test +f3d_test(NAME TestProgress DATA cow.vtp ARGS --progress NO_BASELINE FORCE_PROGRESS_BAR) +f3d_test(NAME TestProgressScene DATA WaterBottle.glb ARGS --progress NO_BASELINE FORCE_PROGRESS_BAR) +f3d_test(NAME TestInteractionProgressReload DATA cow.vtp ARGS --progress NO_BASELINE FORCE_PROGRESS_BAR INTERACTION) #Up;Up;Up;Up + # Drop file test needs https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9199 if(VTK_VERSION VERSION_GREATER_EQUAL 9.1.20220519) # Drop file test uses stream version 1.2 @@ -499,10 +504,6 @@ f3d_test(NAME TestOutputNoBackground DATA cow.vtp ARGS --no-background NO_BASELI f3d_test(NAME TestInteractionRecord DATA cow.vtp ARGS --interaction-test-record=${CMAKE_BINARY_DIR}/Testing/Temporary/interaction.log NO_BASELINE) f3d_test(NAME TestInteractionPlay DATA cow.vtp ARGS --interaction-test-play=${CMAKE_BINARY_DIR}/Testing/Temporary/interaction.log DEPENDS TestInteractionRecord NO_BASELINE) -# Progress test -f3d_test(NAME TestProgress DATA cow.vtp ARGS --progress NO_BASELINE FORCE_PROGRESS_BAR) -f3d_test(NAME TestProgressScene DATA world.obj ARGS --progress NO_BASELINE FORCE_PROGRESS_BAR) - # Window position test f3d_test(NAME TestPosition DATA dragon.vtu ARGS --position=100,100 NO_BASELINE) diff --git a/testing/recordings/TestInteractionProgressReload.log b/testing/recordings/TestInteractionProgressReload.log new file mode 100644 index 0000000000..bc1f55f3c2 --- /dev/null +++ b/testing/recordings/TestInteractionProgressReload.log @@ -0,0 +1,34 @@ +# StreamVersion 1.1 +ExposeEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +KeyPressEvent 354 650 0 0 1 Up +CharEvent 354 650 0 0 1 Up +KeyReleaseEvent 354 650 0 0 1 Up +ExposeEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +KeyPressEvent 354 650 0 0 1 Up +CharEvent 354 650 0 0 1 Up +KeyReleaseEvent 354 650 0 0 1 Up +ExposeEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +RenderEvent 0 599 0 0 0 0 +KeyPressEvent 354 650 0 0 1 Up +CharEvent 354 650 0 0 1 Up +KeyReleaseEvent 354 650 0 0 1 Up