luvcraft/benchmark.lisp
Begin scenario and return the desired keys immediately before it.
Measure steady or streaming world frames through the real Metal path.
The streaming scenario moves one chunk in +X after warmup and records the entire asynchronous load, mesh, and owner-publication transition. #887PO7
The hidden demand-clock canvas avoids the application's 60 Hz scheduler, but
CAMetalLayer may still pace drawable availability. All desired chunk products
arrive before warmup, then frame-count consecutive frames reuse the same world,
pipelines, attachments, and drawable pool. Per-frame values measure CPU
orchestration and encoding. Completion throughput includes final shared-event
drainage and is intentionally not labelled as GPU time.
width and height remain the logical scene controls. The
Retina benchmark deliberately lets SDL make the drawable
denser, then records both extents below so the physical
post-pass cost cannot disappear behind the input size.
Warm the reusable zone buffer, then capture one extra frame after the measured batch so detailed zones and their first-use allocation cannot perturb its metrics.
(session &optional sample)Sample a two-dimensional texture through a sampler at a UV coordinate.
(canvas function)Run FUNCTION with a timestamp on CANVAS's native frame/event thread. The initial native implementation is synchronous: the caller waits for the function's values. The protocol leaves room for a real frame scheduler.
(session timestamp &optional sample)Logical conjunction of tests and raw truth values.
Test whether two compatible scalars are equal.
(world)(scenario session)(player)(camera player)(before session)Logical negation of one test or raw truth value.
(&key (frame-count 120) (warmup-count 30)
(width 960) (height 640)
(world (make-empty-little-block-world :seed 121))
(camera (make-instance 'fly-camera))
(scenario :steady) (high-pixel-density-p nil)
csv-pathname (stream *standard-output*))Measure steady or streaming world frames through the real Metal path. The streaming scenario moves one chunk in +X after warmup and records the entire asynchronous load, mesh, and owner-publication transition. #887PO7 The hidden demand-clock canvas avoids the application's 60 Hz scheduler, but CAMetalLayer may…
(&key (chunk-width 16)
(chunk-height 16)
(chunk-depth 16)
(seed 121))A provider for the system's preferred Metal device.
(&key
(title "luv little block world — click, look, walk")
;; NIL means "as much of this display as
;; comfortably fits"; a capture asks for the
;; exact frame it intends to write out. A
;; KMSDRM console can only present at a real
;; display mode, so the environment may pin
;; the canvas to the panel's native size.
(width (let ((value (uiop:getenv "LUVCRAFT_WIDTH")))
(and value (parse-integer value))))
(height (let ((value (uiop:getenv "LUVCRAFT_HEIGHT")))
(and value (parse-integer value))))
(frames-per-second 60)
(visible-p t)
(fullscreen-p nil)
(high-pixel-density-p t)
(world (make-empty-little-block-world))
(mesher (make-instance
'exposed-face-mesher))
(camera (make-instance 'fly-camera))
player
(selected-block *stone-block*)
(inventory (make-block-inventory))
quit-function
;; A hidden capture wanting animals in frame
;; hands in a population it has already
;; placed; the ordinary game grows its own
;; around the player as it plays.
(critters
(make-instance 'critter-population))
checkpoint-writer
(provider *gpu-provider*)
(sky-clock (make-instance 'sky-clock))
(sky-profile (make-default-sky-profile))
(shadow-diagnostic-p nil)
;; The world-text banner is a proof of the
;; Slug path, not scenery: a caller that
;; wants one asks for it, and the ordinary
;; game sky stays empty.
(world-text-string nil)
(world-text-font-pathname
(cl-dejavu:font-pathname "DejaVuSans.ttf"))
(world-text-distance 8.0)
(world-text-lift 3.0)
(world-text-units-per-em 0.55)
(video-pathname nil)
(video-distance 13.0)
(video-lift 4.5)
(video-height 5.0)
(residency-radius 6)
(publication-limit 2)
(load-schedule-limit 4)
(mesh-capture-limit 1))Open a little CPU-meshed block world. Click to capture the pointer, look with the mouse, walk with WASD, and jump with Space. Once captured, left click removes the block at the centre of view and right click places the selected block. Number keys select materials, middle click picks the targeted material, Shift…
Mutable time-of-day state owned by a luvcraft session. SLY can pause it, set a time, change its rate, or pin it without restarting.
(session &key minimum (timeout 10.0))Wait outside frame encoding for a useful initial set of chunk meshes. MINIMUM defaults to nine or the whole desired set when it is smaller. The visible startup path asks only for the nearest product before its first presentation; deterministic captures wait for the broader default set.
(queue)Block until all work submitted to QUEUE so far has completed on the GPU.
(&key label)Division of two represented quantities.
Subtraction or unary negation.
((trace) &body body)(benchmark &optional (stream *standard-output*))(trace &optional (stream *standard-output*))(benchmark pathname)(session)Stop SESSION exactly once and publish its result to every caller. The sole owner attempts every named release step and closes the canvas and device last. Concurrent and later callers observe the same values or RELEASE-ERROR without releasing a native handle twice.
Intent: measure the frames where traversal creates real asynchronous chunk load, lighting, mesh, GPU upload, and publication work, rather than infer that cost from the fully resident steady benchmark. Evidence: This begins from the same settled 9 by 9 resident world as the steady case, then moves the player one chunk…
Repeatable demand-driven benchmarks of a fully resident luvcraft world.