summaryrefslogtreecommitdiffstats
path: root/virtual-programs/display
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-10-12 16:42:56 +0000
committerOmar Rizwan <omar@omar.website>2023-10-12 16:42:56 +0000
commitcc418917fcf9a95873401a3f59b68771c8c4a1e7 (patch)
treeeb9ab1f520cabcbe3f6665002ec4bf6f64ee0665 /virtual-programs/display
parenttext: Draw with wish; stops the blinking bug. (diff)
downloadfolk-cc418917fcf9a95873401a3f59b68771c8c4a1e7.tar.gz
folk-cc418917fcf9a95873401a3f59b68771c8c4a1e7.zip
text: Batch glyphs into one wish -- fixes performance.
Diffstat (limited to 'virtual-programs/display')
-rw-r--r--virtual-programs/display/text.folk7
1 files changed, 6 insertions, 1 deletions
diff --git a/virtual-programs/display/text.folk b/virtual-programs/display/text.folk
index 992e77b1..a6c828b9 100644
--- a/virtual-programs/display/text.folk
+++ b/virtual-programs/display/text.folk
@@ -124,6 +124,7 @@ On process "display" {
set x $x0; set y $y0
set lineNum 0
+ set instances [list]
for {set i 0} {$i < [string length $text]} {incr i} {
set char [string index $text $i]
if {$char eq "\n"} {
@@ -140,12 +141,16 @@ On process "display" {
}
lassign $glyphInfo advance planeBounds atlasBounds
if {$char ne " "} {
- Wish the GPU draws pipeline "glyph" with arguments \
+ lappend instances \
[list $fontAtlas $fontAtlasSize \
$atlasBounds $planeBounds [list $x $y] $radians $em]
}
lassign [vec2 add [list $x $y] \
[vec2 rotate [list [* $advance $em] 0] $radians]] x y
}
+
+ # We need to batch into one wish so we don't deal with n^2
+ # checks for existing statements for n glyphs.
+ Wish the GPU draws pipeline "glyph" with instances $instances
}
}