Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogc: restore blending mode after every frame #58

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

mardy
Copy link
Collaborator

@mardy mardy commented Mar 4, 2024

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.

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 WinterMute merged commit afa67bc into devkitPro:ogc-sdl-2.28 Mar 5, 2024
3 checks passed
@WinterMute
Copy link
Member

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

WinterMute pushed a commit that referenced this pull request Oct 27, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants