{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19412","repository_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19412/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19412/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19412/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19412","id":191143646,"number":19412,"title":"[CR] Use SDL_gpu library for faster SDL rendering","user":{"login":"mutability","id":3055062,"avatar_url":"https://avatars.githubusercontent.com/u/3055062?v=3","gravatar_id":"","url":"https://api.github.com/users/mutability","html_url":"https://github.com/mutability","followers_url":"https://api.github.com/users/mutability/followers","following_url":"https://api.github.com/users/mutability/following{/other_user}","gists_url":"https://api.github.com/users/mutability/gists{/gist_id}","starred_url":"https://api.github.com/users/mutability/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mutability/subscriptions","organizations_url":"https://api.github.com/users/mutability/orgs","repos_url":"https://api.github.com/users/mutability/repos","events_url":"https://api.github.com/users/mutability/events{/privacy}","received_events_url":"https://api.github.com/users/mutability/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":21,"created_at":"2016-11-22T22:36:54Z","updated_at":"2016-11-24T16:43:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/19412","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19412","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19412.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19412.patch"},"body":"Fixes #19071\r\n\r\nThis changes all the SDL code from using the SDL_render interface to using SDL_gpu (https://github.com/grimfang4/sdl-gpu), which is a separate library that provides a rendering abstraction on top of SDL. This obviously adds a new build dependency for the library, and it also currently requires support for OpenGL 2+ or better. That should be very common these days, anything with any sort of 3D acceleration will have OpenGL 2+ support.\r\n\r\nSDL_gpu can be much faster if you are careful about how you arrange your blitting. In particular if you do many blits from the same texture to the same target, it will batch those together, which produces a huge speedup.\r\n\r\nThis PR first does the obvious changes to use SDL_gpu, and then implements a class that maintains an atlas texture that gathers up all the tiles in a tileset, or all the glyphs in a font, onto a single texture to take advantage of the blitting speedup.\r\n\r\nBenchmarked here on a discrete Nvidia GTX 670M, and on the integrated graphics (Intel HD Graphics 4000). The SDL_gpu code is faster in all cases except one. The exception is when using tiles, maximum zoomed in, minimap on; the minimap code is currently somewhat slower in the SDL_gpu version and that cost dominates that case. The difference there is pretty small, 109fps vs 102fps.\r\n\r\nIn all other case the SDL_gpu code ranges from moderately faster with tiles (48fps vs 29fps for maximum-zoom-out, no minimap) to _dramatically_ faster for \"SDL ASCII\" (52fps vs 5fps, a 10x speedup)\r\n\r\nTested on Linux (Ubuntu 16.04) only. I have done a compile test for WIndows with MXE but I can't test the result as the Windows VM I have available doesn't have suitable opengl acceleration. @BrettDong tested OS X in #19071.\r\n\r\nThis needs testing on Windows and on a wider variety of video cards."},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/262815177","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19412#issuecomment-262815177","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19412","id":262815177,"user":{"login":"patternoia","id":661749,"avatar_url":"https://avatars.githubusercontent.com/u/661749?v=3","gravatar_id":"","url":"https://api.github.com/users/patternoia","html_url":"https://github.com/patternoia","followers_url":"https://api.github.com/users/patternoia/followers","following_url":"https://api.github.com/users/patternoia/following{/other_user}","gists_url":"https://api.github.com/users/patternoia/gists{/gist_id}","starred_url":"https://api.github.com/users/patternoia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patternoia/subscriptions","organizations_url":"https://api.github.com/users/patternoia/orgs","repos_url":"https://api.github.com/users/patternoia/repos","events_url":"https://api.github.com/users/patternoia/events{/privacy}","received_events_url":"https://api.github.com/users/patternoia/received_events","type":"User","site_admin":false},"created_at":"2016-11-24T16:43:21Z","updated_at":"2016-11-24T16:43:21Z","body":"Great work @mutability !\r\nI need to warn you that if merged, this will break the macOS builds, because they are built with FRAMEWORK=1. \r\n`sdl-gpu` already supports building the `SDL2_gpu.framework` if build with `cmake -G \"Unix Makefiles\"`.\r\nYou would need to update the `Makefile` accordingly to link against this framework like it is now done for regular `SDL2.framework`"}}
{"actor":{"display_login":"patternoia"}}