Thread: Graphics on OSX
View Single Post
Old November 9, 2019, 09:55   #11
backwardsEric
Rookie
 
Join Date: Aug 2019
Posts: 24
backwardsEric is on a distinguished road
Quote:
Originally Posted by Nick View Post
I've filed this as a bug, but I have some doubts about my ability to resolve it (most of the work on the Mac port has been done by other people). I'm also finding the Mac port generally a bit laggy and unstable; I will have a look at this some time, but I can't promise when.
The "overdraw cache" used currently does have the potential to render the same grid location multiple times depending on how many times text_hook is invoked to update a row. When porting the Cocoa interface to Hengband, the "overdraw cache" didn't work so I used an approach of noting the changes requested by the text_hook, pict_hook, and wipe_hook calls but did all the actual drawing when xtra_hook was called with TERM_XTRA_FRESH. Putting those changes back into Angband makes the drawing somewhat more efficient - at least according to profiling results of a half-troll warrior blundering around 650'-1000'. Though, for me, both stock 4.2.0 and the modified version felt good enough on the hardware I have.

The changes to main-cocoa.m, from git format-patch, are attached. They do have the disadvantage of taking up more screen real estate to show the same information: the rectangle for one grid location will typically be two pixels wider and taller than in 4.2.0. The changes also don't do anything to address the request to allow the tile size to be separated from the text size.

The profiling results are below. All used an 80 x 24 main window in 13 pt Verdana Bold along with message and inventory windows, both in 10 pt Verdana Bold. The show_target and hp_changes_color display options were on; other system-independent display options were off. The hardware was an early 2015 MacBook Pro (13' Retina, Intel Iris Graphics 6100). The XCode Instruments, either Counters or Time Profiler, were run with the default options. No attempt was made to keep the rendered content the same between runs - the half-troll warrior got progressively deeper in the dungeon and acquired better light sources and telepathy along the way.

Code:
                                         % of total time in Term_fresh() and its children
Instrument        Tiles       Run#       4.2.0  Modified
Counters          None        1          19.7%  11.2%
Counters          None        2          22.0%  13.8%
Counters          Original    1          22.2%  17.8%
Time Profiler     None        1          21.2%  18.1%
Attached Files
File Type: zip updated-cocoa-rendering-patch.txt.zip (11.3 KB, 12 views)
backwardsEric is offline   Reply With Quote