Enable Hardware Acceleration on Windows Phone

I realized that my game is limited to 60 fps on Windows Phone.
When i try to set the flag SDL_RENDERER_ACCELERATED in SDL_CreateWindowAndRenderer() i get an error.
Is it possible to enable it with SDL?

in order words, why does SDL limit my framerate to 60 fps?

in other words, why does SDL limit my framerate to 60 fps?

This is a (very) FAQ: The frame rate is deliberately limited by the
display system (not SDL), so that updates are synchronized with the
display refresh rate.

The primary reason to do that is that it eliminates the ugly, annoying
tearing artifacts you get otherwise. It also has the side effect of
not wasting CPU and GPU cycles rendering frames that are never
displayed - which is actually really rather important on battery
powered devices.

It is possible to disable this feature if you need to, but generally,
you should ONLY ever use that for benchmarking - not in production
code. See https://wiki.libsdl.org/SDL_HINT_RENDER_VSYNCOn Sun, Feb 8, 2015 at 1:18 AM, Meldryt wrote:

in other words, why does SDL limit my framerate to 60 fps?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://consulting.olofson.net http://olofsonarcade.com |
’---------------------------------------------------------------------’

Meldryt wrote:

in order words, why does SDL limit my framerate to 60 fps?

Hardware-acceleration is definitely enabled on Windows Phone, but VSync is probably getting enabled, possibly erroneously (by SDL). If you like, I could look into this, making sure VSync can be turned off on Windows Phone. If so, you might want to keep VSync on (there’s an SDL_Renderer flag, SDL_RENDERER_PRESENTVSYNC, to do this), as it could, in theory, help save on battery power, but I’m happy to look into this regardless.

Cheers,
– David L.

DLudwig wrote:

Hardware-acceleration is definitely enabled on Windows Phone,

Minor correction: Hardware-acceleration is -probably- enabled on Windows Phone, or at least is on some level. All drawing in SDL/WinRT goes through Direct3D at some point, however it is technically possible to route calls through either SDL’s software renderer, or its OpenGL ES render (via ANGLE), first (with Direct3D itself always being invoked at some point in the chain).

That all being said, an app that’s limited to 60 fps does sound like a VSync issue (as opposed to a non-HW-accelerated renderer being used).

Cheers,
– David L.

Message-ID: <1423337325.m2f.46750 at forums.libsdl.org>
Content-Type: text/plain; charset=“iso-8859-1”

I realized that my game is limited to 60 fps on Windows Phone.

Sorry if this question seems a bit blunt, but why do you think that
you need more than 60 fps? Without checking the hardware, you have no
guarantee that the screen can go faster than 60 fps.> Date: Sat, 07 Feb 2015 19:28:45 +0000

From: “Meldryt”
To: sdl at lists.libsdl.org
Subject: [SDL] Enable Hardware Acceleration on Windows Phone

Sorry if this question seems a bit blunt, but why do you think that
you need more than 60 fps? Without checking the hardware, you have no
guarantee that the screen can go faster than 60 fps.

The thing is that i limit the framerate for the simulation and draw step manually, but i cannot keep the framerate for the draw on constant 60. Sometimes its ~61.
(Btw. Where begins the lock exactly? Is it at straight 60.0 fps or at 61.0 fps?)
I dont need to draw more than 60fps but i need it for the rest of my simulation. Unfortunately i slows down the full game loop, not only the render process.

What i can do now is keep that framerate on something between 50-59. That would be enough for me.

A quick update on this:

I took a look into this: turning VSync off on Windows Phone does not appear to be possible, at least not at a glance. Attempting to coax Direct3D 11.1 to turn VSync off (by passing in different parameters to either IDXGISwapChain_Present, or IDXGISwapChain1_Present1) results in either of the following, both in the WinPhone 8.1 emulator, and on an ARM-based WinPhone 8.1 device:

  • with the D3D debug runtime turned off, vsync appears to get turned off, and the framerate can go well above 60 fps, however nothing appears on-screen
  • with the D3D debug runtime turned on, vsync gets turned back on automatically (the framerate gets capped around 60 fps), and the following gets output to the debug console:

DXGI ERROR: IDXGISwapChain::Present: Interval 0 is not supported, changed to Interval 1. [ UNKNOWN ERROR #1024: ]

I took a look around for any device-info flags that might indicate whether or not this was device-specific and detectable, but didn’t find anything. I also tried mucking around with SDL’s D3D11 swap-chain creation settings, but didn’t have any luck there either.

Turning off VSync does, however, appear to work on non-Phone WinRT. The same limitation(s) don’t appear to apply there.

It looks like VSync will probably always have to be on on Windows Phone. If you, or anyone else, wants to try to find a way to get it working otherwise, go for it. I’ll be more than happy to take another look at this if someone finds anything.

Cheers,
– David L.

@DLudwig
Thanks for your effort!