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

Fix #9147: Asynchronously do screenshots during draw tick. #9169

Merged
merged 2 commits into from May 2, 2021

Conversation

michicc
Copy link
Member

@michicc michicc commented May 1, 2021

Motivation / Problem

Screenshots can be triggered from the game thread (e.g. by using rcon). If an accelerated video driver is in use, this causes an illegal OpenGL access as the game thread has no OpenGL context.

Description

Due to a similar problem, changing blitters was already delayed to be execute by the draw tick later on. This PR generalises this delay and uses it to move the actual screenshoting into the draw tick as well.

PR #9140 should be safe after this PR.

Limitations

The screenshot contents will be the screen after the current game tick has computed. Before, if the screenshot was triggered by GUI input, it would capture the state before the game tick.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@michicc michicc added the backport requested This PR should be backport to current release (RC / stable) label May 1, 2021
@michicc michicc force-pushed the pr/fix_9147 branch 2 times, most recently from 6167f3b to 3c5742d Compare May 1, 2021 23:12
@PeterN
Copy link
Member

PeterN commented May 2, 2021

Like and agree with the principle of a generic queue, Unable to comment on "correctness" of implementation other than it looks fine to me.

@LordAro LordAro requested a review from TrueBrain May 2, 2021 12:48
@LordAro
Copy link
Member

LordAro commented May 2, 2021

issue number in the commit message is wrong :>

@TrueBrain TrueBrain requested review from TrueBrain and removed request for TrueBrain May 2, 2021 13:41
…s we may not access the video buffer from the game thread.
PeterN
PeterN previously approved these changes May 2, 2021
@michicc michicc merged commit 1f159f7 into OpenTTD:master May 2, 2021
@michicc michicc deleted the pr/fix_9147 branch May 2, 2021 15:57
@LordAro LordAro added backported This PR is backported to a current release (RC / stable) and removed backport requested This PR should be backport to current release (RC / stable) labels May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported This PR is backported to a current release (RC / stable)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants