diff --git a/prospect-gl/2d.rkt b/prospect-gl/2d.rkt index 8efdae0..161cfd8 100644 --- a/prospect-gl/2d.rkt +++ b/prospect-gl/2d.rkt @@ -299,6 +299,7 @@ ;; Remove old sprites first, to recycle their texture identifiers (if any) (for [(s removed)] (remove-sprite! sprites s)) (for [(s added)] (add-sprite! sprites s)) + ;; (log-info "~a sprites" (splay-tree-count sprites)) (flush-texture-cache!)) (define (process-stop-requests! p) diff --git a/prospect-gl/texture.rkt b/prospect-gl/texture.rkt index 9b8d544..451a7a7 100644 --- a/prospect-gl/texture.rkt +++ b/prospect-gl/texture.rkt @@ -72,6 +72,7 @@ (define/public (dispose) (set! ref-count (- ref-count 1)) (when (zero? ref-count) + ;; (log-info "releasing texture cache entry for ~a" key) (hash-remove! texture-cache key) (hash-set! texture-second-chances key this))) @@ -85,11 +86,13 @@ (lambda () (define t (cond [(hash-has-key? texture-second-chances key) + ;; (log-info "recycling texture cache entry for ~a" key) (define t (hash-ref texture-second-chances key)) (hash-remove! texture-second-chances key) t] [else (define bm (key->bitmap key)) + ;; (log-info "allocating new texture cache entry for ~a" key) (new entry% [key key] [texture (new texture% [bitmap bm])])])) (hash-set! texture-cache key t) t))) @@ -98,6 +101,9 @@ (define (flush-texture-cache!) (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)) ;; (log-info "flushing texture cache (~a entries)" (hash-count texture-second-chances)) (for [(entry (in-hash-values texture-second-chances))] (send entry *cleanup))