Repository navigation
feat(io): import ANARI Captures from the ANARI-SDK capture device - #26
Merged
Merged
Conversation
An ANARI Capture is the text record the SDK's `capture` device writes at a render: the committed state of every object the frame can reach, with large arrays in content-named blobs beside it. import_ANARI_CAPTURE() reads one (format versions 1 and 2) into a scene, so a failed integration test leaves something to browse in vsrViewer rather than only a text diff. The world's instances become transform nodes under a node named for the file, with their groups' surfaces, volumes and lights beneath; instances of one group share its objects. The camera joins the camera pool. The renderer, frame parameters and the version-2 call counts are reported, not applied. Objects keep VSR's seeded default parameters for editors to show, but only the captured ones are enabled, so a device sees exactly what the application committed. What VSR cannot hold (opaque values, motion, bad blobs) is listed in the Import Report under its capture-diff path and the rest still imports. Vela reads the format itself rather than replaying through anari_vsr or linking the SDK's diff library; see ADR 0052. Selected with -anari_capture, the import dialog's ANARI_CAPTURE entry, or vsrRender's anari-capture importer (a .capture extension picks it). The half-float conversions move to vsr/core/HalfFloat.hpp so the reader can decode FLOAT16 values.
Review follow-ups to the ANARI Capture importer: - An object array element VSR cannot hold now leaves an empty slot, reported at the element's own path, instead of dropping the whole array and orphaning the elements already imported. - A null element in a world's or group's surface, volume, light or instance list is an empty slot the format allows, not something dropped, so it is no longer reported. - An object ID must be <label>@<n> with a label the format defines, since the format treats unknown lines as errors. - The parsed text is CaptureText, so "capture" is never used unqualified.
Importing a real ANARI Capture crashed vsrViewer. Scene pools store objects by value and move them as they grow, but the importer cached raw Object and Array pointers by capture ID, and held a reference to the object whose parameters it was setting while importing what those parameters refer to. Any capture big enough to grow a pool then dereferenced freed memory on its second reference to an object, as the first geometry with a shared array did in a 15-surface scene. Arrays are now held as ArrayRef. Scene objects, which the importer creates type-erased, are held as the type and pool index a Parameter would hold, and looked up again after anything that could create objects.
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.
Summary
Adds
import_ANARI_CAPTURE(), which loads an ANARI Capture, the text snapshot the ANARI-SDKcapturedevice writes at each render, into a VSR scene. When an application's capture-based integration test fails, you can open the capture invsrViewerand look at the scene, rather than only reading a text diff.src/devices/capture/README.md. Any other version is rejected with a clear error.Array.-anari_captureon the command line;ANARI_CAPTUREin the import dialog;--importer anari-captureinvsrRender, which also picks it automatically for a.capturefile.Vela reads the format itself. It doesn't replay the file through
anari_vsror link the SDK's diff library; ADR 0052 explains why.anari_vsris unchanged.Other changes:
DataTreeText.cppintovsr/core/HalfFloat.hpp, so the capture reader can decode FLOAT16 values.src/vsr/io/CONTEXT.md.Test plan
vsr::AnariCaptureImportpasses. It has 11 scenarios over hand-written captures:vsrRender.vsrViewer.ctestsuite passes except forvsr::RenderTools, which also fails without this change: the installedvsrRendercan't findlibosdCPU.soon the local machine.vsr::ImageImportand the Studio suites each failed once when the suite ran in parallel and passed on a rerun.