devkitPro / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
14 stars 13 forks source link

ogc: restore blending mode after every frame #58

Closed mardy closed 7 months ago

mardy commented 7 months ago

The OGC_video_flip() function does not simply flip the current video frame: if the mouse cursor is visible, it will draw it. If/when we'll add support for the OSK keyboard, that will also be drawn at the end of every frame.

Since these operations require a specific blending mode, we must make sure that it is restored to its original value before starting drawing the next frame.

We could optimize this by having OGC_video_flip() return a boolean (or a bit mask, in case there are more settings beside the blending mode that it can alter) telling whether the blending mode was changed, in order not to perform an unneeded operation. It might make sense to do it once we decide to do the same for the vertex formats and the texture stages, which change more often and are heavier operations.

WinterMute commented 7 months ago

Nice commit messages btw. I do rather enjoy the detail here.