Log inGet started
Package

specShapes.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

renderer.specShapes

The shapes a render feature's passes are held in. A spec frozen all the way down reads the same on every frame, so the engine keeps it as it read it. A spec a render hands over unfrozen is held as a frozen copy when it reads the same as one handed at the same place in an earlier render, so a feature that builds its specs afresh every frame costs the engine what one handing over frozen specs costs.

  • wholeFrozen(spec) answers whether a spec and every table inside it is frozen and carries no metatable.
  • heldShapeOf(row, spec) answers the spec to hand over at the feature row's next place: the held copy the spec reads as, a new held copy, or the spec itself once the place's specs keep moving.
  • placed holds the placed copy of each frozen spec a stage placed, by the spec it was placed from, with weak keys.
local SpecShapes = require("@builtin::modules.api.engine.renderer.specShapes")
assert(SpecShapes.wholeFrozen(table.freeze({ kind = "fullscreen" })))
assert(not SpecShapes.wholeFrozen({ kind = "fullscreen" }))
local row = { shapes = {}, handedN = 0 }
local first = SpecShapes.heldShapeOf(row, { kind = "fullscreen", order = 1 })
assert(table.isfrozen(first))
row.handedN = 0
assert(SpecShapes.heldShapeOf(row, { kind = "fullscreen", order = 1 }) == first)