public sealed class TextureGraphPreviewsDoc 48 § M4's per-node previews: what every node of a graph is producing, as a picture under the node.
Remarks
⚠ Batch 4 recorded that this needed "a device-side preview path split out of Evaluate". It does not, and the reason is worth writing down. The obstacle looked like the pool: an intermediate image's texture is handed to the next image that needs one the moment its last reader has run, so reading one back after the bake gives a picture of the wrong node. But which images the pool may reuse is the plan's decision and not the evaluator's — TexturePoolSchedule never reuses a slot holding an image in TexturePlan.Outputs — so a plan compiled with PreviewEveryNode keeps every node's image, and one ordinary Evaluate then holds all of them at once. Nothing in the evaluator changed.
Two tiers, and the split is where the cost is. Compiling the graph is a walk that appends records to two lists and is done whenever the graph has changed; evaluating it allocates a texture per node and dispatches, and is done in Update rather than in TryGet, which is called from a draw and is no place to record commands on a device. A node whose picture is a frame old keeps showing it rather than blinking empty, which is ShaderGraphPreviewRenderer's rule for the same reason.
⚠ A preview compilation is not a bake's. Every image is kept, so nothing is pooled and a forty-node graph is forty textures — at Size squared, which is what makes that affordable and why the size is not the graph's.
TexturingModule is what builds one — #1015, closed by a construction beside preview and stackPreview, a TexturePreviewImages over the host's IEditorGraphics, view.Canvas.PreviewSource = … in the graph panel's factory and PluginContext.OnUpdate driving Update. ⚠ The obstacle was never the panel: this type constructed its own TexturePlanEvaluator, so the wiring would have put a third one into a session that goes to some length to hold one, arriving through the commit that closed the issue. It takes a lease now, which is what LayerStackPreview and TextureGraphPreview take.
Fields and properties (7)
public const int SizeHow big a preview is, in texels.
public int CompilationsHow many times a graph has been compiled to a plan — the cheap tier.
public int BakesHow many times a plan has been evaluated on the device — the expensive tier.
public int RefusalsHow many graphs got no pictures at all.
public int SkippedHow many node pictures have been left undrawn because only a host could fill them.
public int LiveHow many nodes have a picture.
public int PendingHow many graphs are waiting to be evaluated.
Methods (6)
public TextureGraphPreviews(Func<TexturePlanEvaluator?> evaluators, Func<TextureGraphCompiler?> compilers, ITexturePreviewImages? images = null)Builds a preview source over an evaluator somebody else owns.
public void Invalidate(NodeGraphModel graph)Says a graph's pictures are out of date.
public bool TryGet(NodeGraphModel graph, GraphNode node, NodeTypeDefinition definition, out NodePreview preview)public void Update(int graphs = 1)Evaluates whatever is out of date.
public void Drop()Gives every picture back, and asks for all of them again.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (2)
- TextureGraphPreviewDeviceTestsVixen.Editor.TextureGraph.Tests
- TexturingModuleVixen.Editor.Texturing