hal/examples.lisp
A running cadence-clock color-cycle demonstration.
Open and return a smoothly cycling clear-color-demo.
speed is the number of complete color cycles per second. Stop the returned
object with stop-clear-color-demo.
Stop demo, close its canvas, and return no values.
A compute shader writing an intermediate texture copied to a canvas.
Open a canvas filled by an s-expression SPIR-V compute shader.
Destroy demo's compute resources and close its canvas.
Render the fixed Slug outline on Metal and return pixels, width, height, format.
The shader specifications remain backend-neutral and independently lower to SPIR-V. This live proof uses Metal because the current no-resource pipeline seam is available there without inventing an empty bind-group abstraction.
Append one padded analytic-roundrect quad to interleaved proof data.
Render one parameterized analytic roundrect family on Metal.
The four instances are a roundrect, capsule, circle, and affinely transformed ellipse. They share one resource-free mathematical pipeline and differ only in dense vertex parameters.
Render one em-normalized quadratic outline through Slug's texture path.
The proof window is the unit em square. outline may contain any number of
closed contours and curves that fit that window; serialization and both axis
traversals are data-driven. Return pixels, width, height, and format.
Render character from font-loader through Slug's GPU outline path.
Join HarfBuzz placement records to ZPB-TTF outlines by glyph ID.
Shape string with HarfBuzz and render one Slug quad per drawable glyph.
The proof target is 768 by 256 pixels. HarfBuzz owns glyph selection, ligatures, clusters, advances, and offsets; ZPB-TTF supplies outlines by the resulting glyph IDs. Return pixels, width, height, format, and shaped text. #4G7064
A running cadence-clock color-cycle demonstration.
A native destination with a lifetime and frame clock.
A MuPDF context: its allocator, its store, and its error stack.
(phase offset)Multiplication and scalar scaling.
Addition over compatible quantities.
(demo timestamp)Subtraction or unary negation.
(context red green blue &optional (alpha 1.0))Division of two represented quantities.
(&key
(title "luv clear color demo")
(width 800)
(height 600)
(frames-per-second 60)
(speed 0.08))Open and return a smoothly cycling CLEAR-COLOR-DEMO. SPEED is the number of complete color cycles per second. Stop the returned object with STOP-CLEAR-COLOR-DEMO.
(&key (title "luv canvas") (width 800) (height 600)
x y (visible-p t) (fullscreen-p nil)
(high-pixel-density-p nil)
(clock (make-demand-clock))
(time (make-lazy-clock))
(presentation-api :vulkan))Construct an unrealized SDL canvas. WIDTH or HEIGHT may be NIL, which asks the display for a size when the window is finally created.
(provider &optional descriptor)If you're lucky, someone has bound this to a working GPU-PROVIDER.
(canvas gpu-provider &optional configuration)Create a GPU presentation relationship between CANVAS and GPU-PROVIDER. When CONFIGURATION is omitted, return the context unconfigured.
A policy object deciding when a canvas should run frames.
(frame-function &key (frames-per-second 60))(handle)Logically invalidate HANDLE immediately. Native teardown may be deferred until submitted work which captured HANDLE has completed.
A compute shader writing an intermediate texture copied to a canvas.
How the children of a list are arranged.
(context)Return CONTEXT's configured drawable extent as (WIDTH HEIGHT), or NIL.
(context function)(encoder &optional descriptor)(pass-encoder)(&key
(title "luv s-expression compute shader")
(width 800)
(height 600))(device descriptor)Asks the DEVICE for a handle to newly created instance of some object fulfilling the DESCRIPTOR.
(&key (width 640) (height 480))(provider)Render the fixed Slug outline on Metal and return pixels, width, height, format. The shader specifications remain backend-neutral and independently lower to SPIR-V. This live proof uses Metal because the current no-resource pipeline seam is available there without inventing an empty bind-group abstraction.
(encoder descriptor)(pass-encoder pipeline)(pass-encoder slot buffer &key (offset 0))(pass-encoder vertex-count
&optional (instance-count 1) (first-vertex 0) (first-instance 0))(queue work)Schedule some command buffers on the QUEUE. Submission is asynchronous: returning does not mean the GPU has finished the work, only that the implementation retains everything the work depends on until it completes. Use SUBMITTED-WORK-DONE to wait.
(buffer &key offset size)Wait for BUFFER's device queue and copy mapped bytes back to the host.
(data center x-axis y-axis half-size radius color
&key (alpha 1.0) (padding 0.08))(provider)Render one parameterized analytic roundrect family on Metal. The four instances are a roundrect, capsule, circle, and affinely transformed ellipse. They share one resource-free mathematical pipeline and differ only in dense vertex parameters.
(provider outline)Render one em-normalized quadratic OUTLINE through Slug's texture path. The proof window is the unit em square. OUTLINE may contain any number of closed contours and curves that fit that window; serialization and both axis traversals are data-driven. Return pixels, width, height, and format.
(outline &key horizontal-band-count vertical-band-count)(serialized)(serialized)(queue destination data data-layout size)(pass-encoder index bind-group)(provider character font-loader)(character font-loader)(shaped font-loader)Test whether two compatible scalars are equal.
(glyph-index font-loader)(draws shaped font-loader)The minimum of compatible quantities.
The maximum of compatible quantities.
(draws width height min-x min-y max-x max-y)(device layout draw resources)(provider string font-pathname)Shape STRING with HarfBuzz and render one Slug quad per drawable glyph. The proof target is 768 by 256 pixels. HarfBuzz owns glyph selection, ligatures, clusters, advances, and offsets; ZPB-TTF supplies outlines by the resulting glyph IDs. Return pixels, width, height, format, and shaped text. #4G7064
(string font-pathname &key direction)Shape STRING with HarfBuzz, returning glyph IDs and font-unit placements. DIRECTION may be :LTR, :RTL, :TTB, or :BTT. With no direction HarfBuzz guesses the segment properties from the Unicode text. #4G7064
Text shaping and outline rendering meet at a deliberately narrow seam. shape-slug-text gives HarfBuzz the UTF-8 run and font bytes, then returns dense records containing glyph IDs, byte clusters, advances, and offsets in font units. It does not ask HarfBuzz to rasterize. The Slug side uses each glyph ID with…
Small live demos built out of the public canvas protocol.