mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-25 02:04:58 +01:00
Timing fixes for processVsync recreation workaround
This commit is contained in:
parent
708c8be089
commit
641277b430
1 changed files with 13 additions and 7 deletions
|
@ -3278,22 +3278,27 @@ void Graphics::processVsync()
|
||||||
{
|
{
|
||||||
SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, vsync ? "1" : "0", SDL_HINT_OVERRIDE);
|
SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, vsync ? "1" : "0", SDL_HINT_OVERRIDE);
|
||||||
|
|
||||||
// FIXME: Sigh... work around SDL2 bug where the VSync hint is only listened to at renderer creation
|
|
||||||
if (screenbuffer == NULL)
|
if (screenbuffer == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Sigh... work around SDL2 bug where the VSync hint is only
|
||||||
|
// listened to at renderer creation
|
||||||
|
|
||||||
|
// Ugh, have to re-create m_screenTexture as well, otherwise the screen
|
||||||
|
// will be black...
|
||||||
|
if (screenbuffer->m_screenTexture != NULL)
|
||||||
|
{
|
||||||
|
SDL_DestroyTexture(screenbuffer->m_screenTexture);
|
||||||
|
}
|
||||||
|
|
||||||
if (screenbuffer->m_renderer != NULL)
|
if (screenbuffer->m_renderer != NULL)
|
||||||
{
|
{
|
||||||
SDL_DestroyRenderer(screenbuffer->m_renderer);
|
SDL_DestroyRenderer(screenbuffer->m_renderer);
|
||||||
}
|
}
|
||||||
screenbuffer->m_renderer = SDL_CreateRenderer(screenbuffer->m_window, -1, 0);
|
screenbuffer->m_renderer = SDL_CreateRenderer(screenbuffer->m_window, -1, 0);
|
||||||
|
|
||||||
// Ugh, have to re-create m_screenTexture as well, otherwise the screen will be black...
|
|
||||||
if (screenbuffer->m_screenTexture != NULL)
|
|
||||||
{
|
|
||||||
SDL_DestroyTexture(screenbuffer->m_screenTexture);
|
|
||||||
}
|
|
||||||
// FIXME: This is duplicated from Screen::init()!
|
// FIXME: This is duplicated from Screen::init()!
|
||||||
screenbuffer->m_screenTexture = SDL_CreateTexture(
|
screenbuffer->m_screenTexture = SDL_CreateTexture(
|
||||||
screenbuffer->m_renderer,
|
screenbuffer->m_renderer,
|
||||||
|
@ -3303,6 +3308,7 @@ void Graphics::processVsync()
|
||||||
240
|
240
|
||||||
);
|
);
|
||||||
|
|
||||||
// Ugh, have to make sure to re-apply graphics options after doing the above, otherwise letterbox/integer won't be applied...
|
// Ugh, have to make sure to re-apply graphics options after doing the
|
||||||
|
// above, otherwise letterbox/integer won't be applied...
|
||||||
screenbuffer->ResizeScreen(-1, -1);
|
screenbuffer->ResizeScreen(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue