graphics-signals

Signal-driven retained drawing output for Garnet renderers

Garnet Graphics Signals

garnet-graphics-signals is an optional bridge between garnet-signals and the backend-neutral drawing renderer contract. Requiring it adds a renderer overload for Signals::Readable(Graphics::Drawing):

require "garnet-graphics-signals"

drawing = Garnet::Signals::Computed.new do
  Garnet::Graphics::Drawing.record do |canvas|
    # Read signal-backed properties while recording ordinary drawing data.
  end
end

texture = renderer.render(drawing, target)

The renderer samples a coherent {value, source_id, revision} snapshot and retains the resulting generic GPU texture for that renderer, target extent, sampling profile, and semantic revision. Repeated calls with no change return the retained texture without re-extraction, tessellation, upload, or rendering. When a dependency changes, the computed drawing publishes a new revision and the renderer replaces that cache entry. Dead signal sources are removed through weak references; cached textures then follow their ordinary resource lifetime.

This bridge is optional so garnet-graphics, concrete renderers, and garnet-signals remain independently usable.

The shard also provides retained ReactivePrimitive, ReactivePicture, and ReactiveGroup nodes. Their transform and opacity inputs may be constants or typed signals. Nodes keep stable identities, unchanged child drawings retain their own revisions, and changed frames still lower to ordinary Garnet drawing operations. Existing backend caches therefore keep unchanged textures, meshes, and stream allocations while only changed operation values are republished.

Repository

graphics-signals

Owner
Statistic
  • 0
  • 0
  • 0
  • 2
  • 2
  • 1 day ago
  • November 30, 2026
License

MIT License

Links
Synced at

Wed, 02 Dec 2026 02:09:23 GMT

Languages