Skip to content

cvcgl_volume_half_float: read the formats VTK asks for; skip GL's read-back where it reports 32F (macOS) - #1333

Merged
transfix merged 4 commits into
masterfrom
fix/volume-half-float-macos
Nov 20, 2026
Merged

transfix merged 4 commits into
masterfrom
fix/volume-half-float-macos

Conversation

@transfix

@transfix transfix commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Makes cvcgl_volume_half_float (from #1213) pass on the macOS package jobs, and says why when it skips the one check that can't be read there.

What macOS showed

The test aborted on all four package-macos jobs of master's full run 43813103811, with 16F textures alive: 0 (32F run) vs 0 (16F run). An earlier diagnostic push (ci/full/volume-half-float-macos, run 43781313300) listed every live texture under Apple Software Renderer:

  • The probe sees all 21 textures, so it isn't blind there.
  • In the 16F run the volume's two 1024x1 tables are reported as R32F (0x822E) and RGB32F (0x8815), the same as in the 32F run.
  • The 16F frame still differs from the 32F one by a little (mean |diff| 0.006, worst 1). If VTK had asked for 32F both times, the two frames would be bit-identical.

Reading VTK 9.5 found nothing Apple-specific in the path. vtkSmartVolumeMapper picks the GPU ray caster. The tables are created by Create2DFromRaw through vtkOpenGLState's format table during RenderVolumetricGeometry. So the likely cause is that Apple's software renderer stores and reports a 16F texture in the matching 32F format, not that VolumeNode's switch fails. The new check below confirms or rules that out on the CI run itself.

The change

  • The test records the internal format VTK passes to glTexImage2D, by texture name. It swaps VTK's glad pointer, as gl_upload_counter.cpp already does in tests that pass on macOS. It does this after renderWindow()->Initialize(), because VTK loads glad once per new context.
  • New strict checks on every desktop GL: the 32F run asks for no 16F textures, and the 16F run asks for at least 2 (the colour and opacity tables). This is VolumeNode's behaviour, and the part that matters for iOS.
  • GL's read-back stays strict: at least 2 16F textures alive in the 16F run, none in the 32F run. It is skipped only when GL reports none as 16F and keeps every texture asked for as 16F in the matching 32F format. The skip prints the renderer and what it kept. Linux and Windows report 16F, so they still take the strict path.
  • The probe clears stale GL errors first and scans names up to 4095 instead of 511.
  • package-macos gets a step that prints the test's lines from LastTest.log on every run, like cvcgl_wake timings, so the skip and its reason show on a pass. Release jobs run ctest twice and the second run replaces LastTest.log, so only the Debug job shows them.

Verified

  • Windows, locally (Intel Iris Xe, MSVC, against a master cvcGL build), the strict path:
    GL: Intel(R) Iris(R) Xe Graphics; VTK made 18 2-D textures (32F run) and 18 (16F run)
    asked for as 16F: 0 (32F run) vs 2 (16F run)
    16F textures alive: 0 (32F run) vs 2 (16F run); kept: R16F as R16F, RGB16F as RGB16F
    ok: and GL keeps them as 16F textures
    cvcgl_volume_half_float: OK
    
  • macOS, ci/full run 44055940377 (5fc7aff): cvcgl_volume_half_float passes on all four package-macos jobs. The Debug job's new step prints:
    GL: Apple Software Renderer; VTK made 20 2-D textures (32F run) and 20 (16F run)
    asked for as 16F: 0 (32F run) vs 2 (16F run)
    16F textures alive: 0 (32F run) vs 0 (16F run); kept: R16F as R32F, RGB16F as RGB32F
    skipped: Apple Software Renderer keeps 16F textures as 32F ones, so its formats cannot show the 16F tables
    
    So VTK does ask for 16F there, and Apple's renderer reports those textures as 32F. It passes on Linux and Windows too.

Also in this PR: a macOS golden for orthoslicer

The same run's other reds were not this change's, but they show on this PR because its checks attach to the same commit:

  • cvcgl_ari_golden failed on all four macOS jobs, on every try, at orthoslicer (from orthoslicer demo: three volume_slice planes beside a volren, a slice view down any axis (P7) #1257, never run on macOS before): 1149 px beyond +-40 (0.1662%, allowed 0.0020%). The frames are the same picture. The nearest-sampled slices' texel edges and the volren's edges land a pixel apart. The four jobs' orthoslicer.actual.png are byte-identical, so 61c2217 commits that frame as orthoslicer.macos.png, as docs/ARIADNE.md describes for widgets, scene and grid.
  • package-linux / libcvc-debug: cvcgl_ariadne_realize timed out (300 s) three times on a slow runner. The median test there ran 2.8x slower than in the last good run (total 7750 s against about 2970 s), and the same test passed in 163 s on libcvc-debug-grpc in the same run. That was a rerun, not a patch.
  • cvcgl_terminal_scene and cvcgl_lowmem_fastdraw each failed once on macOS and passed when ctest retried them.

The branch now has master merged in (ee10e2c). It is pushed again as ci/full/volume-half-float-asked to check the golden against current master on macOS.

… read-back where it reports 32F

On macOS, under Apple's software renderer, the test counted 0 16F textures in both runs and
aborted. The earlier diagnostic run (ci/full/volume-half-float-macos, 43781313300) listed every
live texture there. The probe sees them all, and the volume's two tables (1024x1) are reported
as R32F and RGB32F in the 16F run too. The 16F frame still differs from the 32F one by a
little (mean 0.006, worst 1). That suggests the data was rounded to 16 bits and GL reports the
32F format, not that VTK asked for 32F.

So the test now reads what VTK asks for where it asks: VTK's glad glTexImage2D pointer, swapped
for a recorder once the window is initialised (VTK loads glad once per new context). It
checks, on every desktop GL:
  * the 32F run asks for no 16F textures, and the 16F run asks for at least 2 (the tables);
  * GL keeps them as 16F (at least 2 alive, none in the 32F run), as before.
The read-back is skipped only when GL reports none as 16F AND it keeps every texture asked for
as 16F in the matching 32F format, and the skip names the renderer. Linux and Windows report
16F, so that check stays strict there.

The probe clears stale GL errors first and looks up to name 4095, not 511.

package-macos prints the test's lines from LastTest.log on every run, as for cvcgl_wake, so
the skip and its reason show on a pass.
#1257's orthoslicer golden was made under llvmpipe, and PRs skip the macOS package jobs, so
its first macOS run was the full push CI (44055940377). On all four macOS jobs, on every try,
Apple's software renderer left 1149 px beyond +-40 (0.1662%, allowed 0.0020%), largest channel
difference 187. The frames are the same picture: the nearest-sampled slices' texel edges and the
volren's edges land a pixel apart. The four jobs' orthoslicer.actual.png are the same bytes
(sha256 41d2760b...). That frame is committed as orthoslicer.macos.png, as docs/ARIADNE.md
describes for widgets, scene and grid.
@transfix
transfix enabled auto-merge (squash) November 19, 2026 00:27
@transfix
transfix merged commit e347cf9 into master Nov 20, 2026
29 checks passed
@transfix
transfix deleted the fix/volume-half-float-macos branch November 20, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant