17cupsofcoffee / tetra

🎮 A simple 2D game framework written in Rust

Home Page:https://tetra.seventeencups.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting the swap interval at startup fails on some platforms

17cupsofcoffee opened this issue · comments

Summary

When starting up the game, some platforms (such as Raspberry Pi 3, or a VM) throw an error when we try to set vsync to be on/off.

We should probably just ignore errors in this case, as there's nothing we can actually do about them.

The alternative would be to throw the error and then have a specific 'ignore vsync errors' flag that could be set, but I don't like this, as you'd either have to retry building the context in response to the errors (which is extra boilerplate) or just always have it on (which defeats the purpose of making it configurable).

window::set_vsync throwing an error is fine, as the user has the choice to ignore it or handle it in that scenario (e.g. in a settings dialog, you'd want to tell the player if vsync wasn't working!).

Steps to Reproduce

Run any example on a Raspberry Pi 3 (though I can't verify this myself)

Additional Info

The suggested fix matches up with how FNA and Love2D handle vsync errors at startup (i.e. they don't).

I experienced the same issue in VirtualBox VM with Windows 7 where I tested my project.

Whether this will make stuff work in VMs I have no idea (not sure if it might run into further issues when it actually starts calling into OpenGL), we'll see!

This might be because of a missing GPU

Fixed on main - I will release a new version over the weekend if I get time, but if you want to use this fix in the meantime, you can use a Git dependency.