Add (commented-out) debug aids
This commit is contained in:
parent
543a1753ca
commit
e2dfe2fe78
|
@ -299,6 +299,7 @@
|
||||||
;; Remove old sprites first, to recycle their texture identifiers (if any)
|
;; Remove old sprites first, to recycle their texture identifiers (if any)
|
||||||
(for [(s removed)] (remove-sprite! sprites s))
|
(for [(s removed)] (remove-sprite! sprites s))
|
||||||
(for [(s added)] (add-sprite! sprites s))
|
(for [(s added)] (add-sprite! sprites s))
|
||||||
|
;; (log-info "~a sprites" (splay-tree-count sprites))
|
||||||
(flush-texture-cache!))
|
(flush-texture-cache!))
|
||||||
|
|
||||||
(define (process-stop-requests! p)
|
(define (process-stop-requests! p)
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
(define/public (dispose)
|
(define/public (dispose)
|
||||||
(set! ref-count (- ref-count 1))
|
(set! ref-count (- ref-count 1))
|
||||||
(when (zero? ref-count)
|
(when (zero? ref-count)
|
||||||
|
;; (log-info "releasing texture cache entry for ~a" key)
|
||||||
(hash-remove! texture-cache key)
|
(hash-remove! texture-cache key)
|
||||||
(hash-set! texture-second-chances key this)))
|
(hash-set! texture-second-chances key this)))
|
||||||
|
|
||||||
|
@ -85,11 +86,13 @@
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(define t (cond
|
(define t (cond
|
||||||
[(hash-has-key? texture-second-chances key)
|
[(hash-has-key? texture-second-chances key)
|
||||||
|
;; (log-info "recycling texture cache entry for ~a" key)
|
||||||
(define t (hash-ref texture-second-chances key))
|
(define t (hash-ref texture-second-chances key))
|
||||||
(hash-remove! texture-second-chances key)
|
(hash-remove! texture-second-chances key)
|
||||||
t]
|
t]
|
||||||
[else
|
[else
|
||||||
(define bm (key->bitmap key))
|
(define bm (key->bitmap key))
|
||||||
|
;; (log-info "allocating new texture cache entry for ~a" key)
|
||||||
(new entry% [key key] [texture (new texture% [bitmap bm])])]))
|
(new entry% [key key] [texture (new texture% [bitmap bm])])]))
|
||||||
(hash-set! texture-cache key t)
|
(hash-set! texture-cache key t)
|
||||||
t)))
|
t)))
|
||||||
|
@ -98,6 +101,9 @@
|
||||||
|
|
||||||
(define (flush-texture-cache!)
|
(define (flush-texture-cache!)
|
||||||
(define now (current-seconds))
|
(define now (current-seconds))
|
||||||
|
;; (log-info "~a cache entries, ~a second-chances"
|
||||||
|
;; (hash-count texture-cache)
|
||||||
|
;; (hash-count texture-second-chances))
|
||||||
(when (> now (+ last-flush 10))
|
(when (> now (+ last-flush 10))
|
||||||
;; (log-info "flushing texture cache (~a entries)" (hash-count texture-second-chances))
|
;; (log-info "flushing texture cache (~a entries)" (hash-count texture-second-chances))
|
||||||
(for [(entry (in-hash-values texture-second-chances))] (send entry *cleanup))
|
(for [(entry (in-hash-values texture-second-chances))] (send entry *cleanup))
|
||||||
|
|
Loading…
Reference in New Issue