FNA-XNA / FNA3D

FNA3D - 3D Graphics Library for FNA
http://fna-xna.github.io/
Other
287 stars 48 forks source link

Make the faux-backbuffer optional #124

Closed flibitijibibo closed 3 years ago

flibitijibibo commented 3 years ago

Part of FNA3D's rendering system is a faux-backbuffer, which allows for rendering at a given resolution and then blitting it to the window surface which is a different size. This is important for SDL_WINDOW_FULLSCREEN_DESKTOP in particular.

However, this isn't necessary if the sizes are the same. OpenGL only allocates an intermediate buffer when necessary, and as it turns out this can help performance for really high resolutions like 4K and above. Doing a 4K blit every frame can be expensive, particularly for lower-end hardware.

D3D11 and Vulkan don't do this as far as I can tell, yet both allow this to work; we can just set the swapchain image as the render target instead of the intermediate buffer. Doing this will save a LOT of memory and improve overall performance. OpenGLRenderer can probably be copied aggressively for both renderers.

flibitijibibo commented 3 years ago

We looked into this a bit and it actually seems like a bad idea to do this for Vulkan, since we can't guarantee the presence of a valid swapchain image all the time, unlike everywhere else.

flibitijibibo commented 3 years ago

Resolved by #126