luv

Workshop wiki

instrument-tests.lisp

luft/render/instrument-tests.lisp

system luft/render/test · 28 definitions · on GitHub

in-package#:luft.render.tests
defstruct
instrument-owner-request
:constructormake-instrument-owner-request
function
completion
sb-thread:make-semaphore:count0
:read-onlyt
valuescondition
defclassinstrument-owner-canvas
state:initform:open:accessorinstrument-owner-canvas-state
mailbox:initform
sb-concurrency:make-mailbox:name"LUFT instrument owner requests"
:readerinstrument-owner-canvas-mailbox
thread:readerinstrument-owner-canvas-thread
request-lock:initform
sb-thread:make-mutex:name"LUFT instrument owner request count"
:readerinstrument-owner-canvas-request-lock
request-count:initform0:accessorinstrument-owner-canvas-request-count
request-enqueued:initform
sb-thread:make-semaphore:count0
:readerinstrument-owner-canvas-request-enqueued
reject-requests-p:initformnil:accessorinstrument-owner-canvas-reject-requests-p
stopped:initform
sb-thread:make-semaphore:count0
:readerinstrument-owner-canvas-stopped
defunrun-instrument-owner-canvas
unwind-protect
loopforrequest=
sb-concurrency:receive-message
instrument-owner-canvas-mailboxcanvas
until
eqrequest:stop
do
handler-case
setf
instrument-owner-request-valuesrequest
multiple-value-list
funcall
instrument-owner-request-functionrequest
0.0d0
error
condition
setf
instrument-owner-request-conditionrequest
condition
sb-thread:signal-semaphore
instrument-owner-request-completionrequest
sb-thread:signal-semaphore
instrument-owner-canvas-stoppedcanvas
defmethodinitialize-instance:after
setf
slot-valuecanvas'thread
sb-thread:make-thread:name"LUFT instrument native owner"
defmethodluv:canvas-state
instrument-owner-canvas-statecanvas
defmethodluv:canvas-thread-p
and
slot-boundpcanvas'thread
eqsb-thread:*current-thread*
instrument-owner-canvas-threadcanvas
defmethodluv:request-canvas-frame
when
instrument-owner-canvas-reject-requests-pcanvas
error"The instrument owner rejected the request before its callback."
unless
eq:open
instrument-owner-canvas-statecanvas
error"The instrument owner canvas is not open."
let
request
make-instrument-owner-requestfunction
sb-thread:with-mutex
instrument-owner-canvas-request-lockcanvas
incf
instrument-owner-canvas-request-countcanvas
sb-concurrency:send-message
instrument-owner-canvas-mailboxcanvas
request
sb-thread:signal-semaphore
instrument-owner-canvas-request-enqueuedcanvas
unless
sb-thread:wait-on-semaphore
instrument-owner-request-completionrequest
:timeout2.0
error"The instrument owner did not service a frame request."
when
instrument-owner-request-conditionrequest
error
instrument-owner-request-conditionrequest
values-list
instrument-owner-request-valuesrequest
defunclose-instrument-owner-canvas
unless
eq:closed
instrument-owner-canvas-statecanvas
setf
instrument-owner-canvas-statecanvas
:closed
sb-concurrency:send-message
instrument-owner-canvas-mailboxcanvas
:stop
unless
sb-thread:wait-on-semaphore
instrument-owner-canvas-stoppedcanvas
:timeout2.0
error"The instrument owner did not stop."
sb-thread:join-thread
instrument-owner-canvas-threadcanvas
canvas
defunwait-for-instrument-owner-request
unless
sb-thread:wait-on-semaphore
instrument-owner-canvas-request-enqueuedcanvas
:timeout1.0
error"The expected instrument owner request was not enqueued."
defclassinstrument-test-probe
name:initarg:name:readerinstrument-test-name
priority:initarg:priority:readerinstrument-test-priority
handled-p:initarg:handled-p:initformnil:readerinstrument-test-handled-p
release-count:initform0:accessorinstrument-test-release-count
released-on-owner-p:initformnil:accessorinstrument-test-released-on-owner-p
fail-release-p:initarg:fail-release-p:initformnil:readerinstrument-test-fail-release-p
defmethodrender::viewer-instrument-priority
instrument-test-priorityinstrument
defmethodrender::refresh-viewer-instrument
declare
ignoreviewer
push
list:refresh
instrument-test-nameinstrument
*instrument-test-events*
instrument
defmethodrender::encode-viewer-instrument
viewerpasssurface-texturephysical-extent
declare
ignoreviewerpasssurface-texture
push
list:encode
instrument-test-nameinstrument
physical-extent
*instrument-test-events*
instrument
defmethodrender::handle-viewer-instrument-event
declare
ignoreviewercanvasevent
push
list:event
instrument-test-nameinstrument
*instrument-test-events*
instrument-test-handled-pinstrument
defmethodrender::release-viewer-instrument
let
setf
instrument-test-released-on-owner-pinstrument
incf
instrument-test-release-countinstrument
push
list:release
instrument-test-nameinstrument
*instrument-test-events*
when
instrument-test-fail-release-pinstrument
error"Deliberate instrument release failure."
defteststopped-viewers-consume-and-reject-late-instruments
let*
viewer
clim:make-application-frame'render:viewer:canvascanvas
owned
make-instance'instrument-test-probe:name:owned:priority10
late
make-instance'instrument-test-probe:name:late:priority10:fail-release-pt
conditionnil
unwind-protect
progn
luv:call-with-stop-controller
render::viewer-stop-controllerviewer
lambda
nil
setf
instrument-owner-canvas-reject-requests-pcanvas
t
ok
zerop
instrument-test-release-countowned
setf
instrument-owner-canvas-reject-requests-pcanvas
nil
handler-bind
luv:release-warning#'muffle-warning
ok
eqlate
luv:application-attachment-closed-attachmentcondition
ok
eq:stopped
luv:application-attachment-closed-statecondition
ok
=1
instrument-test-release-countowned
ok
=1
instrument-test-release-countlate
ok
instrument-test-released-on-owner-plate
deftestinstrument-add-versus-stop-never-repopulates-the-terminal-registry
dotimes
iteration16
let*
viewer
clim:make-application-frame'render:viewer:canvascanvas
instrument
make-instance'instrument-test-probe:name:racing:priority10
start
sb-thread:make-semaphore:count0
finished
sb-thread:make-semaphore:count0
add-conditionnil
stop-conditionnil
add-threadnil
stop-threadnil
declare
ignoreiteration
unwind-protect
progn
setfadd-thread
sb-thread:make-thread
lambda
unwind-protect
progn
sb-thread:wait-on-semaphorestart
handler-case
error
failure
setfadd-conditionfailure
sb-thread:signal-semaphorefinished
:name"LUFT racing instrument add"
stop-thread
sb-thread:make-thread
lambda
unwind-protect
progn
sb-thread:wait-on-semaphorestart
handler-case
error
failure
setfstop-conditionfailure
sb-thread:signal-semaphorefinished
:name"LUFT racing instrument stop"
sb-thread:signal-semaphorestart
sb-thread:signal-semaphorestart
unless
and
sb-thread:wait-on-semaphorefinished:timeout2.0
sb-thread:wait-on-semaphorefinished:timeout2.0
error"The LUFT attachment race did not settle."
sb-thread:join-threadadd-thread
setfadd-threadnil
sb-thread:join-threadstop-thread
setfstop-threadnil
ok
nullstop-condition
ok
or
nulladd-condition
ok
eq:stopped
luv:stop-controller-state
render::viewer-stop-controllerviewer
ok
=1
instrument-test-release-countinstrument
ok
instrument-test-released-on-owner-pinstrument
sb-thread:signal-semaphorestart
sb-thread:signal-semaphorestart
whenadd-thread
sb-thread:join-threadadd-thread
whenstop-thread
sb-thread:join-threadstop-thread
defmethodrender::refresh-viewer-instrument

This is the semantic shape of a metabar operation which rebuilds and publishes the renderer cohort at the frame boundary.

setf
render::viewer-rendererviewer
instrument
defclassinspector-preparation-probe
revisions:initformnil:accessorinspector-preparation-probe-revisions
defmethodmcluv::prepare-mirror-compositor-revision
declare
ignoremirror
pushrevision
inspector-preparation-probe-revisionsprobe
deftesta-static-inspector-prepares-before-the-renderer-is-borrowed
let*
viewer
clim:make-application-frame'render:viewer:renderer:installed-cohort:inspector-pt
mirror
make-instance'mcluv:luv-gpu-mirror:sheetnil:targetnil:contextnil
probe
unwind-protect
progn
setf
mcluv:mirror-compositormirror
probe
render::viewer-inspector-mirrorviewer
mirror
ok
equal
listrevision
inspector-preparation-probe-revisionsprobe
deftesta-frame-borrows-the-renderer-after-instrument-publication
let*
viewer
clim:make-application-frame'render:viewer:renderer:retired-cohort
instrument
make-instance'instrument-test-renderer-replacement:replacement:installed-cohort
unwind-protect
progn
ok
eq:installed-cohort
render::viewer-rendererviewer
deftestoff-thread-instrument-removal-waits-for-the-borrowing-frame
let*
viewer
clim:make-application-frame'render:viewer:canvascanvas
instrument
make-instance'instrument-test-probe:name:owned:priority10
borrowed
sb-thread:make-semaphore:count0
continue
sb-thread:make-semaphore:count0
frame-finished
sb-thread:make-semaphore:count0
remove-finished
sb-thread:make-semaphore:count0
snapshot-kept-pnil
remove-resultnil
frame-conditionnil
remove-conditionnil
frame-threadnil
remove-threadnil
unwind-protect
progn
setfframe-thread
sb-thread:make-thread
lambda
handler-case
luv:request-canvas-framecanvas
lambda
timestamp
declare
ignoretimestamp
let
sb-thread:signal-semaphoreborrowed
unless
sb-thread:wait-on-semaphorecontinue:timeout1.0
error"The borrowing frame was not released."
setfsnapshot-kept-p
eqinstrument
firstsnapshot
error
condition
setfframe-conditioncondition
sb-thread:signal-semaphoreframe-finished
:name"LUFT borrowing frame"
unless
sb-thread:wait-on-semaphoreborrowed:timeout1.0
error"The instrument frame did not borrow its snapshot."
setfremove-thread
sb-thread:make-thread
lambda
handler-case
setfremove-result
error
condition
setfremove-conditioncondition
sb-thread:signal-semaphoreremove-finished
:name"LUFT off-thread instrument removal"
ok
not
sb-thread:wait-on-semaphoreremove-finished:timeout0.02
"remove remains synchronous while the frame owns its snapshot"
ok
zerop
instrument-test-release-countinstrument
"the borrowed instrument has not been released"
sb-thread:signal-semaphorecontinue
unless
sb-thread:wait-on-semaphoreframe-finished:timeout1.0
error"The borrowing frame did not finish."
unless
sb-thread:wait-on-semaphoreremove-finished:timeout1.0
error"The queued instrument removal did not finish."
sb-thread:join-threadframe-thread
setfframe-threadnil
sb-thread:join-threadremove-thread
setfremove-threadnil
ok
nullframe-condition
ok
nullremove-condition
oksnapshot-kept-p
okremove-result
ok
=1
instrument-test-release-countinstrument
ok
instrument-test-released-on-owner-pinstrument
sb-thread:signal-semaphorecontinue
whenframe-thread
sb-thread:join-threadframe-thread
whenremove-thread
sb-thread:join-threadremove-thread
deftestinstrument-release-errors-return-through-the-frame-boundary
let*
viewer
clim:make-application-frame'render:viewer:canvascanvas
instrument
make-instance'instrument-test-probe:name:failing:priority10:fail-release-pt
conditionnil
unwind-protect
progn
handler-case
error
failure
setfconditionfailure
ok
typepcondition'error
ok
=1
instrument-test-release-countinstrument
ok
instrument-test-released-on-owner-pinstrument
deftestluft-m-x-is-an-application-command-available-with-pointer-released
let*
ok
equal'
render::com-execute-command
render::viewer-key-commandviewer
key-press:x:character#\x:modifiers'
:meta
ok
=1
count'render::com-execute-commandentries:key#'mcluv:command-menu-entry-command-name
ok
find"Execute Command"entries:test#'string=:key#'mcluv:command-menu-entry-label
ok
find"Toggle Lobby Panel"entries:test#'string=:key#'mcluv:command-menu-entry-label

The shared palette does not advertise a command it cannot yet prompt.

ok
null
find'render::com-start-movingentries:key#'mcluv:command-menu-entry-command-name