luv

Workshop wiki

paint-benchmark.lisp

mcclim/paint-benchmark.lisp

system luv/mcclim/paint-benchmark · 9 definitions · on GitHub

Equal-work Tracy sanity check for the direct McCLIM paint pipelines.

in-package#:mcluv
defunmake-paint-benchmark-pattern
&optional
size32
let
pixels
make-array
listsizesize
:element-type'
unsigned-byte32
dotimes
ysize
dotimes
xsize
let
checker
if
evenp
#xff3f7ee8#xffea4775
setf
arefpixelsyx
checker
make-patternpixelsnil
define-application-framepaint-benchmark-frame
mode:initform:solid:accessorpaint-benchmark-mode
shape-count:initarg:shape-count:readerpaint-benchmark-shape-count
pattern:initform:readerpaint-benchmark-pattern
:menu-barnil
:panes
canvas:application:display-function'display-paint-benchmark:scroll-barsnil
:layouts
defaultcanvas
defunpaint-benchmark-ink
framemodelefttoprightbottomrowcolumn
ecasemode
:solid
if
evenp
+rowcolumn
make-rgb-color0.180.480.92
make-rgb-color0.920.320.48
:gradient
make-linear-gradientlefttoprightbottom
make-rgb-color0.180.480.92
make-rgb-color0.920.320.48
:image
transform-region
make-transformation
/
-rightleft
32.0
00
/
-bottomtop
32.0
lefttop
paint-benchmark-patternframe
defundisplay-paint-benchmark
framestream
loopwithcolumns=16withwidth=54withheight=34withradius=10withmode=
paint-benchmark-modeframe
forindexbelow
paint-benchmark-shape-countframe
forcolumn=
modindexcolumns
forrow=
floorindexcolumns
forleft=
+8
*column62
fortop=
+8
*row44
forright=
+leftwidth
forbottom=do
draw-analytic-rounded-rectangle*streamlefttoprightbottom:radiusradius:filledt:ink
paint-benchmark-inkframemodelefttoprightbottomrowcolumn
defunprepare-paint-benchmark-sample
framemirrormode
setf
paint-benchmark-modeframe
mode
let
*application-frame*frame
luv:with-cpu-trace-zone
:mcluv/redisplay
redisplay-frame-panesframe:force-pt
repaint-gpu-mirrormirror:present-pnil
defunpaint-benchmark-stream-size
mirror
let
medium
sheet-medium
mirror-sheetmirror
list:commands
length
gpu-medium-commandsmedium
:solid-vertices
/
length
gpu-medium-verticesmedium
6
:analytic-vertices
/
length
gpu-medium-analytic-verticesmedium
12
:gradient-vertices
/
length
gpu-medium-gradient-verticesmedium
21
:image-vertices
/
length
gpu-medium-image-verticesmedium
12
:cached-images
hash-table-count
gpu-mirror-image-paintsmirror
defuncall-with-paint-sample-zone
modeshape-countfunction
ecasemode
:solid
luv:with-cpu-trace-zone
:mcluv/solid-paint-sample:tracy-valueshape-count
funcallfunction
:gradient
luv:with-cpu-trace-zone
:mcluv/gradient-paint-sample:tracy-valueshape-count
funcallfunction
:image
luv:with-cpu-trace-zone
:mcluv/image-paint-sample:tracy-valueshape-count
funcallfunction
defunrun-paint-tracy-benchmark
&key
shape-count256
repetitions30
ready-function

Trace equal solid, analytical-gradient, and cached-image roundrect frames.

let
unwind-protect
let*
port
find-port:server-path'
:luv-gpu
manager
or
first
climi::frame-managersport
make-instance'luv-frame-manager:portport
setfframe
make-application-frame'paint-benchmark-frame:frame-managermanager:enablenil:shape-countshape-count:width1010:height720
let*
sheet
frame-top-level-sheetframe
mirror
sheet-direct-mirrorsheet
unless
typepmirror'luv-gpu-mirror
error"Paint benchmark did not realize a GPU mirror."
let
modes'
:solid:gradient:image
sizes
setf
sheet-enabled-psheet
t

Compile every pipeline and populate the sole immutable image texture before Tracy attaches.

dolist
modemodes
pushsizes
unless
=1
hash-table-count
gpu-mirror-image-paintsmirror
error"Expected one warmed image texture, found ~D."
hash-table-count
gpu-mirror-image-paintsmirror
whenready-function
funcallready-function
looprepeat300untildo
sleep0.1
finally
unless
error"Tracy did not connect within 30 seconds."
luv:tracy-message"McCLIM paint comparison begins"
looprepeatrepetitionsdo
dolist
modemodes
luv:tracy-message"McCLIM paint comparison complete"
unless
=1
hash-table-count
gpu-mirror-image-paintsmirror
error"Image texture cache grew during steady state."
setfsizes
nreversesizes
formatt"Paint streams: ~S~%"sizes
formatt"Paint cache: 1 source texture after ~D steady image draws.~%"
*shape-countrepetitions
force-output
sizes
whenframe
destroy-frameframe