Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix possible crash with Font:getLines and Pass:text;
- Font:getLines/Pass:text use temp memory for strings/vertices. - Due to the recent morgue fix, resizing the atlas will now do a GPU submit to flush the transfers before destroying the atlas. - This GPU submit also rewinds the temp allocator, invalidating the temp memory used for the lines/vertices, causing a use-after-free. There are 2 changes here: - Only flush transfers if the destroyed resource actually has pending work (we're already tracking this w/ lastTransferRead/Write). - Restore the allocator cursor after doing the submit. Having to restore the allocator offset is kinda tricky/complicated, which sucks. Other solutions might be: - Avoid using temp memory in those Font methods. More generally, adopt a rule where you can't use temp memory if it's possible that there will be a submit while you're using the temp memory. - Find some way to stop destroying the old font atlas during a resize? - Don't rewind the temp allocator on every GPU submit. Instead only rewind it at the end of a frame, or only when Lua does the submit.
- Loading branch information