luv

Workshop wiki

direct-compositor.lisp

mcclim/direct-compositor.lisp

system luv/mcclim · 56 definitions · on GitHub

Application-neutral retained McCLIM commands composed directly into a caller-owned GPU render pass. The implementation lives here so games can share semantic, target-resolution UI without depending on one another.

in-package#:mcluv
defclassdirect-gpu-mirror-compositor
mirror:initarg:mirror:readerwidget-overlay-mirror
render-state:initformnil:accessorwidget-overlay-render-state
direct-device:initformnil:accessordirect-widget-device
direct-target-format:initformnil:accessordirect-widget-target-format
direct-depth-stencil:initformnil:accessordirect-widget-depth-stencil
direct-shape-layout:initformnil:accessordirect-widget-shape-layout
direct-image-layout:initformnil:accessordirect-widget-image-layout
direct-image-sampler:initformnil:accessordirect-widget-image-sampler
direct-pipelines:initform
make-hash-table:test#'eq
:readerdirect-widget-pipelines
direct-pipeline-families:initform
make-hash-table:test#'eq
:readerdirect-mirror-pipeline-families
direct-resources:initformnil:accessordirect-widget-resources
direct-frame-states:initform
make-hash-table:test#'equal
:readerdirect-widget-frame-states
direct-image-bind-groups:initform
make-hash-table:test#'equal
:readerdirect-widget-image-bind-groups
direct-lattice-layout:initformnil:accessordirect-widget-lattice-layout
direct-lattice-bind-groups:initform
make-hash-table:test#'equal
:readerdirect-widget-lattice-bind-groups
text-layout:initformnil:accessordirect-widget-text-layout
text-bind-groups:initform
make-hash-table:test#'equal
:readerdirect-widget-text-bind-groups
solid-fragment-dependent:initformnil:accessordirect-mirror-solid-fragment-dependent
:documentation

A retained McCLIM command stream replayed into a caller-owned GPU pass.

The caller supplies one 4x4 clip-space affine state and the actual destination texture for each frame. Semantic solids, analytic shapes, gradients, images, lattices, and Slug text are evaluated at that texture's native resolution; there is no pane raster, upload, sampled copy, drawable acquisition, or queue submission in this compositor. Per-drawable uniform resources are keyed by luv:canvas-frame-resource-key so multiple frames may remain in flight without an unbounded cache of backend wrapper objects.

defclassdirect-widget-frame-state
buffer:initarg:buffer:readerdirect-widget-frame-buffer
shape-bind-group:initarg:shape-bind-group:readerdirect-widget-frame-shape-bind-group
source-state:initarg:source-state:readerdirect-widget-frame-source-state
prepared-revision:initformnil:accessordirect-widget-frame-prepared-revision
defstructdirect-mirror-pipeline-familypipelineresourcessource-revisionsolid-fragment-revision
define-conditiondirect-mirror-pipelines-not-prepared
error
families:initarg:families:readerdirect-mirror-missing-families
format:initarg:format:readerdirect-mirror-missing-target-format
depth-stencil:initarg:depth-stencil:readerdirect-mirror-missing-depth-stencil
:report
lambda
conditionstream
formatstream

Direct McCLIM pipeline~P ~{~S~^, ~} ~ must be prepared before the application render pass opens (format ~S, depth ~S).

length
direct-mirror-missing-familiescondition
direct-mirror-missing-familiescondition
direct-mirror-missing-target-formatcondition
direct-mirror-missing-depth-stencilcondition
define-conditiondirect-mirror-release-error
error
failures:initarg:failures:readerdirect-mirror-release-failures
:report
lambda
conditionstream
let
failures
direct-mirror-release-failurescondition
formatstream"~D direct McCLIM resource~:P failed to release"
lengthfailures
whenfailures
formatstream"; first failure for ~S: ~A"
caarfailures
cdarfailures
write-char#\.stream
defstructdirect-widget-command-encode-context

Resources borrowed together for one direct-widget command replay.

overlaydestination-statesource-state
defmethodgpu-command-rasterized-p
declare
ignorecompositorcommand
nil

Solid and Slug CPU vertices already contain rgb * authored alpha. These stages forward that premultiplied rgb exactly once; coverage is subsequently applied to the complete rgba value by the fragment stage.

shader:define-shaderdirect-mirror-slug-vertex-specification
:stage:vertex:inputs
position-alpha:vec3:location0
outline-horizontal:vec3:location1
atlas-vertical:vec3:location2
band-low:vec3:location3
band-high:vec3:location4
color-input:vec3:location5
:resources
state:uniform-block:set0:binding2:members
center:vec4
right:vec4
up:vec4
:outputs
clip-position:vec4:built-in:position
render-coordinate:vec2:location0
render-atlas-base:vec2:location1
render-band-bounds:vec4:location2
render-band-counts:vec2:location3
render-color:vec4:location4
let*
local-x
shader:swizzleposition-alpha:x
local-y
shader:swizzleposition-alpha:y
shader:set-outputclip-position
+center
*rightlocal-x
*uplocal-y
shader:set-outputrender-coordinate
shader:swizzleoutline-horizontal:xy
shader:set-outputrender-atlas-base
shader:swizzleatlas-vertical:xy
shader:set-outputrender-band-bounds
shader:set-outputrender-band-counts
shader:vec2
shader:swizzleoutline-horizontal:z
shader:swizzleatlas-vertical:z
shader:set-outputrender-color
shader:vec4color-input
shader:swizzleposition-alpha:z
shader:define-shaderdirect-widget-solid-vertex-specification
:stage:vertex:inputs
position-opacity:vec3:location0
color-input:vec3:location1
:resources
state:uniform-block:set0:binding2:members
center:vec4
right:vec4
up:vec4
:outputs
clip-position:vec4:built-in:position
color-output:vec4:location0
let*
local-x
shader:swizzleposition-opacity:x
local-y
shader:swizzleposition-opacity:y
alpha
shader:swizzleposition-opacity:z
shader:set-outputclip-position
+center
*rightlocal-x
*uplocal-y
shader:set-outputcolor-output
shader:vec4color-inputalpha
shader:define-shaderdirect-widget-analytic-vertex-specification
:stage:vertex:inputs
position:vec3:location0
local-coordinate:vec3:location1
half-size-radius:vec3:location2
color:vec3:location3
:resources
state:uniform-block:set0:binding2:members
center:vec4
right:vec4
up:vec4
:outputs
clip-position:vec4:built-in:position
render-coordinate:vec2:location0
render-half-size-radius:vec3:location1
render-color:vec4:location2
let*
shader:set-outputclip-position
+center
*rightlocal-x
*uplocal-y
shader:set-outputrender-coordinate
shader:swizzlelocal-coordinate:xy
shader:set-outputrender-half-size-radiushalf-size-radius
shader:set-outputrender-color
shader:vec4
*coloralpha
alpha
shader:define-shaderdirect-widget-relief-vertex-specification
:stage:vertex:inputs
position:vec3:location0
local-coordinate:vec3:location1
half-size-radius:vec3:location2
color:vec3:location3
relief:vec3:location4
:resources
state:uniform-block:set0:binding2:members
center:vec4
right:vec4
up:vec4
:outputs
clip-position:vec4:built-in:position
render-coordinate:vec2:location0
render-half-size-radius:vec3:location1
render-color:vec4:location2
render-height:float:location3
let*
shader:set-outputclip-position
+center
*rightlocal-x
*uplocal-y
shader:set-outputrender-coordinate
shader:swizzlelocal-coordinate:xy
shader:set-outputrender-half-size-radiushalf-size-radius
shader:set-outputrender-color
shader:vec4
*coloralpha
alpha
shader:set-outputrender-height
shader:define-shaderdirect-widget-gradient-vertex-specification
:stage:vertex:inputs
position:vec3:location0
local-coordinate:vec3:location1
half-size-radius:vec3:location2
paint-coordinate-kind:vec3:location3
start-color:vec3:location4
end-color:vec3:location5
paint-alphas:vec3:location6
:resources
state:uniform-block:set0:binding2:members
center:vec4
right:vec4
up:vec4
:outputs
clip-position:vec4:built-in:position
render-coordinate:vec2:location0
render-half-size-radius:vec3:location1
render-paint-coordinate-kind:vec3:location2
render-start-color:vec3:location3
render-end-color:vec3:location4
render-paint-alphas:vec2:location5
let*
shader:set-outputclip-position
+center
*rightlocal-x
*uplocal-y
shader:set-outputrender-coordinate
shader:swizzlelocal-coordinate:xy
shader:set-outputrender-half-size-radiushalf-size-radius
shader:set-outputrender-paint-coordinate-kindpaint-coordinate-kind
shader:set-outputrender-start-colorstart-color
shader:set-outputrender-end-colorend-color
shader:set-outputrender-paint-alphas
shader:swizzlepaint-alphas:xy
shader:define-shaderdirect-widget-image-vertex-specification
:stage:vertex:inputs
position:vec3:location0
local-coordinate:vec3:location1
half-size-radius:vec3:location2
texture-coordinate-opacity:vec3:location3
:resources
state:uniform-block:set0:binding2:members
center:vec4
right:vec4
up:vec4
:outputs
clip-position:vec4:built-in:position
render-coordinate:vec2:location0
render-half-size-radius:vec3:location1
render-texture-coordinate:vec2:location2
render-opacity:float:location3
let*
shader:set-outputclip-position
+center
*rightlocal-x
*uplocal-y
shader:set-outputrender-coordinate
shader:swizzlelocal-coordinate:xy
shader:set-outputrender-half-size-radiushalf-size-radius
shader:set-outputrender-texture-coordinate
shader:swizzletexture-coordinate-opacity:xy
shader:set-outputrender-opacity
shader:swizzletexture-coordinate-opacity:z
defunrelease-direct-gpu-mirror-resources
overlay

Logically release every GPU resource retained by overlay.

luv:destroy invalidates each wrapper now and defers native teardown through the backend submission frontier when an in-flight command buffer still owns it.

flet
table-values
let
values
maphash
lambda
keyvalue
declare
ignorekey
pushvaluevalues
table
clrhashtable
values
let*
bind-groups
mapcan#'table-values
list
direct-widget-text-bind-groupsoverlay
direct-widget-image-bind-groupsoverlay
direct-widget-lattice-bind-groupsoverlay
frame-states
table-values
direct-widget-frame-statesoverlay
family-states
table-values
direct-mirror-pipeline-familiesoverlay
resources
remove-duplicates
appendbind-groups
direct-widget-resourcesoverlay
mapcan
lambda
family
copy-list
direct-mirror-pipeline-family-resourcesfamily
family-states
:test#'eq
dependent
direct-mirror-solid-fragment-dependentoverlay
failuresnil

Detach every logical owner before invoking user-visible destruction. One failing wrapper can therefore neither prevent later releases nor remain reachable for a second destructive pass.

clrhash
direct-widget-pipelinesoverlay
setf
widget-overlay-render-stateoverlay
nil
direct-widget-deviceoverlay
nil
direct-widget-target-formatoverlay
nil
direct-widget-depth-stenciloverlay
nil
direct-widget-shape-layoutoverlay
nil
direct-widget-image-layoutoverlay
nil
direct-widget-lattice-layoutoverlay
nil
direct-widget-image-sampleroverlay
nil
direct-widget-resourcesoverlay
nil
direct-widget-text-layoutoverlay
nil
direct-mirror-solid-fragment-dependentoverlay
nil
labels
attempt
objectthunk
handler-case
funcallthunk
error
condition
push
consobjectcondition
failures
dolist
stateframe-states
attempt
direct-widget-frame-source-statestate
lambda
release-gpu-frame-state
direct-widget-frame-source-statestate
dolist
resource
list
direct-widget-frame-shape-bind-groupstate
direct-widget-frame-bufferstate
whenresource
attemptresource
lambda
luv:destroyresource
dolist
resourceresources
whenresource
attemptresource
lambda
luv:destroyresource
whendependent
attemptdependent
whenfailures
error'direct-mirror-release-error:failures
nreversefailures
overlay
eval-when
:load-toplevel:execute

Live images may retain the old raster-named :BEFORE adapter. It would release twice once the neutral primary below is installed.

let*
method
find-methodgeneric'
:before
nil
whenmethod
remove-methodgenericmethod
defmethodrelease-raster-mirror-compositor

Legacy adapter for callers compiled against the raster-era protocol name.

defgenericdirect-gpu-mirror-depth-stencil
compositor
:documentation

Return compositor's depth declaration for every semantic pipeline.

defmethoddirect-gpu-mirror-depth-stencil
declare
ignorecompositor
nil
defgenericset-direct-gpu-mirror-scissor
passcompositormirrorsurface-textureclip
defundirect-mirror-projected-screen-vertex

Project pane point U,V through state, retaining W,U,V for hit testing.

let*
local-x
-
*2.0u
1.0
local-y
-
*2.0v
1.0
clip-x
+
arefstate0
*local-x
arefstate4
*local-y
arefstate8
clip-y
+
arefstate1
*local-x
arefstate5
*local-y
arefstate9
clip-w
+
arefstate3
*local-x
arefstate7
*local-y
arefstate11
if
zeropclip-w
list0.00.0clip-wuv
list
*width0.5
+1.0
/clip-xclip-w
*height0.5
+1.0
/clip-yclip-w
clip-wuv
defmethodset-direct-gpu-mirror-scissor
passmirrorsurface-textureclip

Set a conservative target-pixel scissor for pane-local clip.

Clipping belongs to the shared affine compositor: both a world panel and a HUD panel can rotate, scale, or project the same retained command stream.

destructuring-bind
surface-widthsurface-height&restignored
luv:gpu-texture-sizesurface-texture
declare
ignoreignored
multiple-value-bind
logical-widthlogical-height
if
not
and
plusplogical-width
plusplogical-height
progn
luv:set-scissor-rectpass00surface-widthsurface-height
t
destructuring-bind
lefttoprightbottom
orclip
list00logical-widthlogical-height
let*
state
widget-overlay-render-statecompositor
corners
mapcar
lambda
point
direct-mirror-projected-screen-vertexstatesurface-widthsurface-height
/
firstpoint
logical-width
/
secondpoint
logical-height
list
listlefttop
listrighttop
listleftbottom
listrightbottom

Crossing the camera plane makes the projected AABB unbounded. The full target is the conservative answer.

if
some
lambda
corner
not
plusp
thirdcorner
corners
progn
luv:set-scissor-rectpass00surface-widthsurface-height
t
let*
x
max0
minsurface-width
floor
reduce#'mincorners:key#'first
y
max0
minsurface-height
floor
reduce#'mincorners:key#'second
right
maxx
minsurface-width
ceiling
reduce#'maxcorners:key#'first
bottom
maxy
minsurface-height
ceiling
reduce#'maxcorners:key#'second
width
-rightx
height
-bottomy
defunensure-direct-mirror-solid-fragment-dependent
compositor
or
direct-mirror-solid-fragment-dependentcompositor
setf
direct-mirror-solid-fragment-dependentcompositor
defundirect-mirror-solid-fragment-revision
compositor
multiple-value-bind
revisionevent
declare
ignoreevent
revision
defunensure-direct-mirror-shape-layout
compositordevice
or
direct-widget-shape-layoutcompositor
let
layout
luv:createdevice
luv:make-bind-group-layout-descriptor:label"direct McCLIM affine layout":entries'
:binding2:type:uniform-buffer
setf
direct-widget-shape-layoutcompositor
layout
direct-widget-resourcescompositor
conslayout
direct-widget-resourcescompositor
layout
defunensure-direct-mirror-image-layout
compositordevice
or
direct-widget-image-layoutcompositor
let
samplernil
completed-pnil
unwind-protect
progn
setflayout
luv:createdevice
luv:make-bind-group-layout-descriptor:label"direct McCLIM image layout":entries'
:binding0:type:texture
:binding1:type:sampler
:binding2:type:uniform-buffer
sampler
luv:createdevice
luv:make-sampler-descriptor:label"direct McCLIM image sampler"
setf
direct-widget-image-layoutcompositor
layout
direct-widget-image-samplercompositor
sampler
direct-widget-resourcescompositor
list*samplerlayout
direct-widget-resourcescompositor
completed-pt
layout
unlesscompleted-p
dolist
resource
removenil
listsamplerlayout
ignore-errors
luv:destroyresource
defunensure-direct-mirror-lattice-layout
compositordevice
or
direct-widget-lattice-layoutcompositor
let
layout
luv:createdevice
luv:make-bind-group-layout-descriptor:label"direct McCLIM lattice layout":entries'
:binding0:type:texture
:binding2:type:uniform-buffer
setf
direct-widget-lattice-layoutcompositor
layout
direct-widget-resourcescompositor
conslayout
direct-widget-resourcescompositor
layout
defunensure-direct-mirror-text-layout
compositordevice
or
direct-widget-text-layoutcompositor
let
layout
luv:createdevice
luv:make-bind-group-layout-descriptor:label"direct McCLIM Slug layout":entries'
:binding0:type:texture
:binding1:type:texture
:binding2:type:uniform-buffer
setf
direct-widget-text-layoutcompositor
layout
direct-widget-resourcescompositor
conslayout
direct-widget-resourcescompositor
layout
defunensure-direct-mirror-family-layout
compositordevicefamily

Shape bindings also serve the application-specific chassis adapter and are the common affine ABI for every direct mirror.

ecasefamily
:solid:analytic:relief:gradient
direct-widget-shape-layoutcompositor
:image
:lattice
defundirect-mirror-family-specifications
compositorfamily
ecasefamily
:solid
values"solid"
direct-widget-shape-layoutcompositor
shader:shader-specification-for:mcluv-solid:fragment
24'
:shader-location0:offset0:format:float32x3
:shader-location1:offset12:format:float32x3
:analytic
values"analytic"
direct-widget-shape-layoutcompositor
48'
:shader-location0:offset0:format:float32x3
:shader-location1:offset12:format:float32x3
:shader-location2:offset24:format:float32x3
:shader-location3:offset36:format:float32x3
:relief
values"relief"
direct-widget-shape-layoutcompositor
60'
:shader-location0:offset0:format:float32x3
:shader-location1:offset12:format:float32x3
:shader-location2:offset24:format:float32x3
:shader-location3:offset36:format:float32x3
:shader-location4:offset48:format:float32x3
:gradient
values"gradient"
direct-widget-shape-layoutcompositor
84'
:shader-location0:offset0:format:float32x3
:shader-location1:offset12:format:float32x3
:shader-location2:offset24:format:float32x3
:shader-location3:offset36:format:float32x3
:shader-location4:offset48:format:float32x3
:shader-location5:offset60:format:float32x3
:shader-location6:offset72:format:float32x3
:image
values"image"
direct-widget-image-layoutcompositor
48'
:shader-location0:offset0:format:float32x3
:shader-location1:offset12:format:float32x3
:shader-location2:offset24:format:float32x3
:shader-location3:offset36:format:float32x3
:lattice
values"lattice"
direct-widget-lattice-layoutcompositor
48'
:shader-location0:offset0:format:float32x3
:shader-location1:offset12:format:float32x3
:shader-location2:offset24:format:float32x3
:shader-location3:offset36:format:float32x3
:text
values"Slug text"
direct-widget-text-layoutcompositor
72'
:shader-location0:offset0:format:float32x3
:shader-location1:offset12:format:float32x3
:shader-location2:offset24:format:float32x3
:shader-location3:offset36:format:float32x3
:shader-location4:offset48:format:float32x3
:shader-location5:offset60:format:float32x3
defunbuild-direct-mirror-pipeline-family
compositorfamilytarget-formatdepth-stencilsource-revisionsolid-fragment-revision
multiple-value-bind
namelayoutvertex-specfragment-specstrideattributes
let
creatednil
completed-pnil
unwind-protect
labels
create
descriptor
let
resource
luv:create
direct-widget-devicecompositor
descriptor
pushresourcecreated
resource
let*
vertex
create
luv:make-shader-module-descriptor:label
formatnil"direct McCLIM ~A vertex"name
:language:mathematical:codevertex-spec
fragment
create
luv:make-shader-module-descriptor:label
formatnil"direct McCLIM ~A fragment"name
:language:mathematical:codefragment-spec
pipeline
create
luv:make-render-pipeline-descriptor:label
formatnil"direct McCLIM ~A"name
:layoutlayout:vertex`
:module,vertex:buffers
:array-stride,stride:attributes,attributes
:fragment`
:module,fragment:targets
:format,target-format:blend:premultiplied-alpha
:depth-stencildepth-stencil:primitive'
:topology:triangle-list
setfcompleted-pt
make-direct-mirror-pipeline-family:pipelinepipeline:resourcescreated:source-revisionsource-revision:solid-fragment-revisionsolid-fragment-revision
unlesscompleted-p
dolist
resourcecreated
ignore-errors
luv:destroyresource
defundirect-mirror-pipeline-family-current-p
statefamilysource-revisionsolid-fragment-revision
andstate
=source-revision
direct-mirror-pipeline-family-source-revisionstate
or
not
eqfamily:solid
=solid-fragment-revision
direct-mirror-pipeline-family-solid-fragment-revisionstate
defunrelease-direct-mirror-family-resources
families

Exhaustively release detached pipeline FAMILY states.

let
failuresnil
dolist
familyfamilies
dolist
resource
direct-mirror-pipeline-family-resourcesfamily
handler-case
luv:destroyresource
error
condition
push
consresourcecondition
failures
whenfailures
error'direct-mirror-release-error:failures
nreversefailures
defunprepare-direct-gpu-mirror-pipelines
compositortarget-formatdepth-stencilfamilies

Compile only families, transactionally, before an application render pass.

let
device
mirror-device
widget-overlay-mirrorcompositor
whenfamilies
unless
and
eqdevice
direct-widget-devicecompositor
eqtarget-format
direct-widget-target-formatcompositor
equaldepth-stencil
direct-widget-depth-stencilcompositor
setf
direct-widget-devicecompositor
device
direct-widget-target-formatcompositor
target-format
direct-widget-depth-stencilcompositor
depth-stencil
dolist
familyfamilies
let*
solid-fragment-revision
if
member:solidfamilies
0
stale-families
remove-if
lambda
family
direct-mirror-pipeline-family-current-p
gethashfamily
direct-mirror-pipeline-familiescompositor
familysource-revisionsolid-fragment-revision
families
whenstale-families
let
candidatesnil
completed-pnil
unwind-protect
progn
dolist
familystale-families
push
consfamily
build-direct-mirror-pipeline-familycompositorfamilytarget-formatdepth-stencilsource-revisionsolid-fragment-revision
candidates

Never publish a mixed cohort if source changed during a slow backend compilation. The old families remain good.

unless
error"Direct McCLIM shader source changed while compiling."
when
member:solidstale-families
unless
=solid-fragment-revision
error"Direct McCLIM solid shader changed while compiling."
let
retired
dolist
entrycandidates
let*
family
carentry
candidate
cdrentry
old
gethashfamily
direct-mirror-pipeline-familiescompositor
whenold
pusholdretired
setf
gethashfamily
direct-mirror-pipeline-familiescompositor
candidate
gethashfamily
direct-widget-pipelinescompositor
direct-mirror-pipeline-family-pipelinecandidate
setfcompleted-pt
unlesscompleted-p
compositor
defundirect-gpu-mirror-missing-pipeline-families
compositortarget-formatdepth-stencilfamilies
if
and
eq
mirror-device
widget-overlay-mirrorcompositor
direct-widget-devicecompositor
eqtarget-format
direct-widget-target-formatcompositor
equaldepth-stencil
direct-widget-depth-stencilcompositor
remove-if
lambda
family
gethashfamily
direct-widget-pipelinescompositor
families
families
defunrequire-direct-gpu-mirror-pipelines
compositortarget-formatdepth-stencilfamilies

Assert that families were prepared before the caller opened its pass.

let
missing
direct-gpu-mirror-missing-pipeline-familiescompositortarget-formatdepth-stencilfamilies
whenmissing
error'direct-mirror-pipelines-not-prepared:familiesmissing:formattarget-format:depth-stencildepth-stencil
compositor
defunensure-direct-gpu-mirror-pipelines
compositortarget-formatdepth-stencil

Legacy encode adapter: verify preparation without compiling in an open pass.

alexandria:when-let
revision
gpu-mirror-prepared-revision
widget-overlay-mirrorcompositor
require-direct-gpu-mirror-pipelinescompositortarget-formatdepth-stencil
gpu-prepared-frame-pipeline-familiesrevision
compositor
defunprepare-direct-gpu-mirror
compositor&key
revision
alexandria:when-let
mirror
widget-overlay-mirrorcompositor
target-format
depth-stencil

Prepare compositor's current semantic families outside a render pass.

let
mirror
widget-overlay-mirrorcompositor
when
andmirrorrevision
let*
context
mirror-contextmirror
target-format
whentarget-format
prepare-direct-gpu-mirror-pipelinescompositortarget-formatdepth-stencil
gpu-prepared-frame-pipeline-familiesrevision
compositor
defmethodprepare-mirror-compositor-revision
mirrorrevision
declare
ignoremirror
prepare-direct-gpu-mirrorcompositor:revisionrevision
defmethodprepare-mirror-compositor-target-revision
mirrorrevision&keytarget-format
depth-stencil
declare
ignoremirror
prepare-direct-gpu-mirrorcompositor:revisionrevision:target-formattarget-format:depth-stencildepth-stencil
defmethodinitialize-instance:after

A compositor is normally attached after the mirror's first repaint. This closes that seam without waiting for an application render pass.

defgenericevict-direct-gpu-mirror-frame-key
compositorframe-key
:documentation

Evict compositor's GPU state retained for one canvas frame-key.

The state and all bind groups which borrow its affine buffer are detached before any native resource is destroyed. Other drawable slots remain available.

defmethodevict-direct-gpu-mirror-frame-key
frame-key
alexandria:when-let
frame-state
gethashframe-key
direct-widget-frame-statescompositor
let
bind-groupsnil
failuresnil

Collect every cache entry which borrows FRAME-STATE before mutating a table. Common Lisp does not promise that REMHASH during MAPHASH is portable, and logical detachment must precede fallible destruction.

dolist
table
list
direct-widget-text-bind-groupscompositor
direct-widget-image-bind-groupscompositor
direct-widget-lattice-bind-groupscompositor
let
keysnil
maphash
lambda
keygroup
when
eqframe-state
pushkeykeys
pushgroupbind-groups
table
dolist
keykeys
remhashkeytable
remhashframe-key
direct-widget-frame-statescompositor
labels
attempt
objectthunk
handler-case
funcallthunk
error
condition
push
consobjectcondition
failures
attempt
direct-widget-frame-source-stateframe-state
lambda
release-gpu-frame-state
direct-widget-frame-source-stateframe-state
dolist
resource
remove-duplicates
appendbind-groups
list
direct-widget-frame-shape-bind-groupframe-state
direct-widget-frame-bufferframe-state
:test#'eq
whenresource
attemptresource
lambda
luv:destroyresource
whenfailures
error'direct-mirror-release-error:failures
nreversefailures
compositor
defundirect-gpu-mirror-frame-resource-key
overlaysurface-texture

Return the bounded backend frame key for surface-texture.

Metal presents a stable drawable through a fresh Lisp texture wrapper each time. Keying by that wrapper leaks one uniform buffer and several bind groups per frame; the canvas context exposes the native drawable identity instead.

alexandria:if-let
context
mirror-context
widget-overlay-mirroroverlay
surface-texture
defunensure-direct-widget-frame-state
overlaysurface-texture
let
key
or
gethashkey
direct-widget-frame-statesoverlay
let
buffernil
groupnil
source-statenil
completed-pnil
unwind-protect
progn
setfbuffer
luv:create
direct-widget-deviceoverlay
luv:make-buffer-descriptor:label"direct McCLIM affine state":size64:usage'
:uniform
group
luv:create
direct-widget-deviceoverlay
luv:make-bind-group-descriptor:label"direct McCLIM affine bindings":layout
direct-widget-shape-layoutoverlay
:entries`
:binding2:resource,buffer
source-state
make-instance'gpu-mirror-frame-state:mirror
widget-overlay-mirroroverlay
let
state
make-instance'direct-widget-frame-state:bufferbuffer:shape-bind-groupgroup:source-statesource-state
setf
gethashkey
direct-widget-frame-statesoverlay
state
completed-pt
state
unlesscompleted-p
whensource-state
ignore-errors
whengroup
whenbuffer
defunmaterialize-direct-widget-frame-revision
compositorframe-staterevision

Upload revision once into frame-state's backend-bounded source slot.

unless
eqrevision
direct-widget-frame-prepared-revisionframe-state
upload-gpu-prepared-frame-revision
direct-widget-frame-source-stateframe-state
direct-widget-devicecompositor
revision

Publish the pairing only after all six dense buffers contain revision.

setf
direct-widget-frame-prepared-revisionframe-state
revision
direct-widget-frame-source-stateframe-state
defunensure-direct-widget-image-bind-group
overlaypaintframe-state
let
key
listpaintframe-state
or
gethashkey
direct-widget-image-bind-groupsoverlay
setf
gethashkey
direct-widget-image-bind-groupsoverlay
luv:create
direct-widget-deviceoverlay
luv:make-bind-group-descriptor:label"direct McCLIM image bindings":layout
direct-widget-image-layoutoverlay
:entries`
:binding0:resource,
gpu-image-paint-viewpaint
:binding1:resource,
direct-widget-image-sampleroverlay
:binding2:resource,
direct-widget-frame-bufferframe-state
defunensure-direct-widget-lattice-bind-group
overlaypaintframe-state
let
key
listpaintframe-state
or
gethashkey
direct-widget-lattice-bind-groupsoverlay
setf
gethashkey
direct-widget-lattice-bind-groupsoverlay
luv:create
direct-widget-deviceoverlay
luv:make-bind-group-descriptor:label"direct McCLIM lattice bindings":layout
direct-widget-lattice-layoutoverlay
:entries`
:binding0:resource,
gpu-lattice-paint-viewpaint
:binding2:resource,
direct-widget-frame-bufferframe-state
defunensure-direct-widget-text-bind-group
overlayatlasframe-state
let
key
listatlasframe-state
or
gethashkey
direct-widget-text-bind-groupsoverlay
setf
gethashkey
direct-widget-text-bind-groupsoverlay
luv:create
direct-widget-deviceoverlay
luv:make-bind-group-descriptor:label"direct McCLIM Slug bindings":layout
direct-widget-text-layoutoverlay
:entries`
:binding0:resource,
luv.slug:slug-glyph-atlas-band-viewatlas
:binding1:resource,
luv.slug:slug-glyph-atlas-curve-viewatlas
:binding2:resource,
direct-widget-frame-bufferframe-state
defmethodencode-gpu-command
let
overlay
direct-widget-command-encode-context-overlaycontext
destination-state
direct-widget-command-encode-context-destination-statecontext
source-state
direct-widget-command-encode-context-source-statecontext
encode-gpu-draw-rangepass
gethash:solid
direct-widget-pipelinesoverlay
direct-widget-frame-shape-bind-groupdestination-state
gpu-frame-state-vertex-buffersource-state
gpu-solid-command-first-vertexcommand
gpu-solid-command-vertex-countcommand
defmethodencode-gpu-command
let
overlay
direct-widget-command-encode-context-overlaycontext
destination-state
direct-widget-command-encode-context-destination-statecontext
source-state
direct-widget-command-encode-context-source-statecontext
encode-gpu-draw-rangepass
gethash:analytic
direct-widget-pipelinesoverlay
direct-widget-frame-shape-bind-groupdestination-state
gpu-frame-state-analytic-buffersource-state
gpu-analytic-command-first-vertexcommand
gpu-analytic-command-vertex-countcommand
defmethodencode-gpu-command
let
overlay
direct-widget-command-encode-context-overlaycontext
destination-state
direct-widget-command-encode-context-destination-statecontext
source-state
direct-widget-command-encode-context-source-statecontext
encode-gpu-draw-rangepass
gethash:relief
direct-widget-pipelinesoverlay
direct-widget-frame-shape-bind-groupdestination-state
gpu-frame-state-relief-buffersource-state
gpu-relief-analytic-command-first-vertexcommand
gpu-relief-analytic-command-vertex-countcommand
defmethodencode-gpu-command
let
overlay
direct-widget-command-encode-context-overlaycontext
destination-state
direct-widget-command-encode-context-destination-statecontext
source-state
direct-widget-command-encode-context-source-statecontext
encode-gpu-draw-rangepass
gethash:gradient
direct-widget-pipelinesoverlay
direct-widget-frame-shape-bind-groupdestination-state
gpu-frame-state-gradient-buffersource-state
gpu-gradient-analytic-command-first-vertexcommand
gpu-gradient-analytic-command-vertex-countcommand
defmethodencode-gpu-command
let*
overlay
direct-widget-command-encode-context-overlaycontext
destination-state
direct-widget-command-encode-context-destination-statecontext
source-state
direct-widget-command-encode-context-source-statecontext
encode-gpu-draw-rangepass
gethash:lattice
direct-widget-pipelinesoverlay
ensure-direct-widget-lattice-bind-groupoverlay
gpu-prepared-lattice-command-paintcommand
destination-state
gpu-frame-state-analytic-buffersource-state
gpu-prepared-lattice-command-first-vertexcommand
gpu-prepared-lattice-command-vertex-countcommand
defmethodencode-gpu-command
let*
overlay
direct-widget-command-encode-context-overlaycontext
destination-state
direct-widget-command-encode-context-destination-statecontext
source-state
direct-widget-command-encode-context-source-statecontext
encode-gpu-draw-rangepass
gethash:image
direct-widget-pipelinesoverlay
ensure-direct-widget-image-bind-groupoverlay
gpu-prepared-image-command-paintcommand
destination-state
gpu-frame-state-image-buffersource-state
gpu-prepared-image-command-first-vertexcommand
gpu-prepared-image-command-vertex-countcommand
defmethodencode-gpu-command
let*
overlay
direct-widget-command-encode-context-overlaycontext
destination-state
direct-widget-command-encode-context-destination-statecontext
source-state
direct-widget-command-encode-context-source-statecontext
encode-gpu-draw-rangepass
gethash:text
direct-widget-pipelinesoverlay
ensure-direct-widget-text-bind-groupoverlay
gpu-prepared-text-command-atlascommand
destination-state
gpu-frame-state-text-buffersource-state
gpu-prepared-text-command-first-vertexcommand
gpu-prepared-text-command-vertex-countcommand
luv:zdefun
encode-direct-gpu-mirror:zone:mcluv/encode-direct-mirror:value
length
or
gpu-mirror-prepared-commands
widget-overlay-mirrorcompositor
nil
compositorpassdestination-texturestate&key
frame-texturedestination-texture

Replay COMPOSITOR's textureless McCLIM mirror into PASS under affine STATE.

DESTINATION-TEXTURE describes the open pass for format and clipping. FRAME-TEXTURE names the bounded in-flight presentation slot whose host-visible buffers are safe to update; normally both arguments are the same texture.

let*
mirror
widget-overlay-mirrorcompositor
commands
andrevision
gpu-prepared-frame-commandsrevision
whencommands
let
target-format
luv:gpu-texture-formatdestination-texture
depth-stencil

This is a guard only. Compilation belongs to mirror publication or prepare-direct-gpu-mirror, both outside the application's open pass.

require-direct-gpu-mirror-pipelinescompositortarget-formatdepth-stencil
gpu-prepared-frame-pipeline-familiesrevision
let*
frame-state
ensure-direct-widget-frame-statecompositorframe-texture
source-state
materialize-direct-widget-frame-revisioncompositorframe-staterevision
encode-context
make-direct-widget-command-encode-context:overlaycompositor:destination-stateframe-state:source-statesource-state
active-clip
list:unset
clip-visible-pt
declare
dynamic-extentencode-context
setf
widget-overlay-render-statecompositor
state
luv:write-buffer
direct-widget-frame-bufferframe-state
state
dolist
commandcommands
let
clip
unless
equalclipactive-clip
setfactive-clipclipclip-visible-p
set-direct-gpu-mirror-scissorpasscompositormirrordestination-textureclip
whenclip-visible-p
encode-gpu-commandcommandpassencode-context
destructuring-bind
widthheight&restignored
luv:gpu-texture-sizedestination-texture
declare
ignoreignored
compositor