Repository navigation
cvcGL: golden-image tests for the Ariadne ImGui/VTK backend (§16.6 phase 1) - #725
Merged
Merged
Conversation
…§16.6 phase 1) cvcgl_ari_golden runs every .ari in src/cvcGL/test/golden through AriRuntime + ImGuiBackend offscreen (960x720, overlay visible) and compares the frame with the PNG of the same name. Five documents: windows, menus (File opened by a scripted click), every widget kind (with a hovered tooltip), grid layouts, and a scene. Repeatable captures: a pinned OFL font (Liberation Sans, shipped in the test tree), UI scale 1, touch off, the show/hide button hidden, panels open, ImGui's frame delta pinned, >= 4 frames at a fixed dt, and a check that one more frame draws the same pixels. Comparison (src/cvcGL/test/golden_util.h, reusable): VTK PNG I/O, a per-channel tolerance and a max mismatch fraction, actual.png + diff.png on failure, and CVC_UPDATE_GOLDEN=1 to regenerate (reference goldens only under llvmpipe; CVC_GOLDEN_VARIANT for platform goldens). +-40 a channel with at most 0.002% of pixels beyond it was measured to pass Ubuntu's Mesa 25.2.8 llvmpipe and an NVIDIA GPU against the cvcpkg Mesa 25.3.6 goldens, and to fail a one-step slider change (144 px) and a window moved by one pixel (12167 px). ImGuiOverlay: - setFixedDeltaTime() pins io.DeltaTime (0 = wall clock, the default). - A failed ImGui GL backend init is no longer retried: under VTK's EGL fallback (no X display) the retry crashed on a null GL_VERSION. enabled() now reports it, and the test skips (fails under CVC_REQUIRE_RENDER). CI prints each document's numbers from LastTest.log on every run and uploads the actual/diff PNGs when a libcvc job fails. docs/ARIADNE.md §12 covers adding a golden test and regenerating goldens.
… renders The first CI run of #725 passed cvcgl_ari_golden on every lane only because it skipped: no CI job installs imgui, so every CI build of cvcGL compiled ImGuiOverlay and the Ariadne ImGui backend as inert stubs ("cvcGL: imgui not found"), and the macOS/Windows package lanes have no yaml-cpp either. - package-linux: cvcpkg install imgui next to the Ariadne optional deps. - package-macos / package-windows: cvcpkg install imgui yaml-cpp next to vtk. - cvcgl_ari_golden: a build without ImGui or the YAML loader (like a GL the overlay cannot start on) fails under CVC_REQUIRE_RENDER instead of skipping, so the Linux job cannot quietly pass again.
ModelTest.ObjWithUvsMaterialTexture and ModelTest.ReadGeometryObjFlatten both wrote the same OBJ + MTL + PNG fixture into gtest's TempDir. ctest runs them as parallel processes, and #725's recipe / ubuntu-latest / Debug job started the two together: one read cvc_model_test_tex.png while the other was rewriting it ("cvc::image stb read ... unknown image type"), so the texture was dropped and the test failed. Each case now writes into TempDir()/cvc_model_test_<name>/; the file names, and so the .obj/.mtl references and the asserted texture path, are unchanged.
…every cvcgl_* ctest) Master's #583 removed cvcgl_test::disableSwapThrottle() and sets __GL_SYNC_TO_VBLANK=0 / vblank_mode=0 on every test in src/cvcGL through ctest's ENVIRONMENT, which covers cvcgl_ari_golden too; the merge left the call behind and package-linux / libcvc-debug failed to compile it.
…den-harness # Conflicts: # src/cvcGL/CMakeLists.txt
…aches libcvcGL cvcgl_imgui_table_columns (#727) segfaulted on package-windows once #725 put a real imgui into the Windows CI build. The test creates its ImGui context in the test executable and drives ImGuiBackend, which runs inside cvcGL.dll. The cvcpkg Windows imgui is a static library, so the exe and the DLL each carry a copy of imgui with its own current context, and the backend found none. (ImGuiOverlay creates its context inside libcvcGL, so overlay hosts never hit this; a shared imgui, as on Linux, has one copy.) ImGuiBackend::setImGuiContext(ctx) makes ctx current in libcvcGL's copy; the test hands its context over after CreateContext and clears it before destroying it, which it now does by pointer (with a shared imgui clearing libcvcGL's current context clears the test's too).
… Renderer) macOS CI (package-macos / libcvc-release-grpc, run 39427493969) renders with the Apple Software Renderer: deterministic (each document settles to identical frames), but its anti-aliased edges and shading differ from llvmpipe. Against the llvmpipe goldens windows / menus / grid had 3-6 px beyond +-40 (pass, limit 13), widgets 40 and scene 467 (fail; all on edges and silhouettes). Rather than loosen the tolerance until a one-step value change passes, those two get macOS platform goldens, the job's own actual frames from the ari-golden-macOS-libcvc-release-grpc artifact, looked at before committing. docs/ARIADNE.md section 12 records the numbers and how to refresh a macOS golden from the CI artifact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Roadmap §16.6 phase 1: the Ariadne ImGui/VTK backend's rendering becomes CI-testable instead of only compile-checked.
What it does
cvcgl_ari_goldenruns every.ariinsrc/cvcGL/test/golden/throughAriRuntime+ImGuiBackend, the same path pycvc_gl and the GL hosts use. Each document renders offscreen at 960x720 with the overlay visible, and the frame is compared with<name>.png. AriRuntime is used as it is, unmodified.windows.ariclosable:,frame: {border}, tinted textmenus.ariwidgets.arivisible_when, a computedbind:, and a hovered tooltipgrid.ariscene.ariRepeatable captures:
golden/fontswith its licence;Comparison:
golden_util.his a reusable helper. It uses VTK's PNG reader and writer (no ImageMagick coder involved) and takes a per-channel tolerance plus a maximum mismatch fraction. On a failure it writes<name>.actual.png+<name>.diff.png(mismatches red, the golden dimmed underneath) and reports the count and bounding box.CVC_UPDATE_GOLDEN=1regenerates. Reference goldens can only be written under llvmpipe;CVC_GOLDEN_VARIANTwrites a platform golden<name>.<variant>.png, which defaults tomacoson Apple.Tolerance (measured, not guessed). The goldens were made under cvcpkg's Mesa 25.3.6 llvmpipe on Xvfb, as in CI. The table counts pixels differing by more than 8 / more than 40 in a channel:
So the test allows ±40 a channel, with at most 0.002% of pixels (13) beyond it. Every comparison prints its spread. CI prints those numbers from LastTest.log on every run, pass or fail, and uploads the PNGs when a libcvc job fails (
ari-golden-<OS>-<lane>). macOS and Windows numbers will show up there. If Apple's GL needs its own pictures, they become*.macos.pngfrom that artifact.Two small ImGuiOverlay changes
setFixedDeltaTime()pinsio.DeltaTime. The default is still the wall clock.ImGui_ImplOpenGL3_Initfails and the retry segfaulted on a nullGL_VERSION. imgui's loader goes through GLX, so the failure latch is process-wide.enabled()now reports the failure, and the test skips, or fails underCVC_REQUIRE_RENDER=1.Found by the goldens (not fixed here; the docs steer around them)
size:stays at ImGui's 32 px minimum. On the window's first frame,ariadne.cpp(§11.4) persists the size before ImGui has fitted it. On the next frame it seeds that size back throughSetNextWindowSize(..., FirstUseEver), which cancels the auto-fit. This affects hello.ari's Controls window too.light:leaves the realized scene unlit, for any azimuth, with or without shadows. hello.ari's bunny renders dark brown inariadne_hellotoo, on llvmpipe and on NVIDIA.scene.ariuses the fallback headlight instead.layout: {kind: horizontal}is ignored on a window body. The embedded schema also rejects thesize: {hint,min,max}map and"50%"strings that the loader accepts.CI never built the ImGui backend (fixed here)
The first CI run passed
cvcgl_ari_goldenon every lane, but only because it skipped. No CI job installed imgui, so every CI build of cvcGL compiledImGuiOverlayand the Ariadne ImGui backend as inert stubs (cvcGL: imgui not found). The macOS and Windows package lanes also lacked yaml-cpp. Commit a598d8a fixes this:imgui, plusyaml-cppon macOS and Windows, from cvcpkg;CVC_REQUIRE_RENDER=1, a build without ImGui or without the YAML loader now fails rather than skips, so the Linux job can't quietly pass again.The failing
package-macos / libcvc-release-grpc-staticcheck fails the same way on master at 381cadc (run 39303777747).dyldcan't load@rpath/libcares.2.19.3.dylib, whichlibgrpc.44.1.1.dylibneeds, so ctest stops during gtest discovery. It is unrelated to this PR.CI numbers (a598d8a, imgui installed)
On macOS, the pixels beyond ±40 (limit 13) were: windows 3, menus 4, grid 6, widgets 40, scene 467. They are all on anti-aliased edges and silhouettes. The renderer is deterministic: every document settled to identical frames. I didn't loosen the tolerance, because that would let a one-step value change through. Instead, 0a3640a commits that job's own actual frames, taken from its
ari-golden-macOS-libcvc-release-grpcartifact and checked by eye, aswidgets.macos.pngandscene.macos.png. macOS compares those two documents against its own renderer.Also in this PR: with real imgui on Windows, #727's
cvcgl_imgui_table_columnssegfaulted. Its ImGui context lived in the test exe's static copy of imgui, not in cvcGL.dll's. 7d0feee addsImGuiBackend::setImGuiContext(ctx), and the test hands its context to cvcGL with it.The same run's
recipe / ubuntu-latest / DebugfailedModelTest.ObjWithUvsMaterialTexture. That's a pre-existing race, fixed in 40fde8f: twoModelTestcases wrote the same OBJ/MTL/PNG fixture into gtest's TempDir, ctest ran them in parallel, and one read the PNG while the other was rewriting it. Each case now writes into its own directory.Verified locally
cvcgl_ari_goldenis byte-exact, ×3 viactest --repeat until-fail:3. The fullcvcgl_*suite passes 70/70.DISPLAY(EGL), the test skips with rc 0, and fails with rc 1 underCVC_REQUIRE_RENDER=1.docs/ARIADNE.md§12 explains how to add a golden test and regenerate goldens.