I am developing a small game for Windows Phone which is based on silverlight animation.
Some animations are using silverlight animation framework like Trandforms API and some animations are frame based. What I am doing is, I am running a Storyboard having very small duration and when it;s completed event fires, I am changing image frame there. So images get replaced every time completed event get fired. But I think it is causing memory leakage in my game and memory footprint is increasing with time.
I want to ask is it a right way to do frame base animations or is there any better way to do this in silverlight???
What I can do to reduce memory consumption so that it does not increase with time.
As a general rule, beware animating anything which can't be GPU accelerated or bitmap cached. You haven't given enough information to tell if this is your issue but start by monitoring the frame rate counters, redraw regions and cache visualisation.
You can detect memory leaks with the built in profiling tools.
See DEBUG > Start Windows Phone Application Analysis
Related
EDIT: This is not a code bottleneck. Profiling shows identical CPU usage regardless of fluctuating GPU ms. Also I incorrectly talked about glbufferdata when I first posted; it's glbuffersubdata.
As part of an optimisation drive for the Android build of our app, I reorganised the render pipeline of our engine in a way that exposed a very significant performance bottleneck on certain iOS devices under iOS11.
Our engine manages a mixed scene of 2D geometry (UI) and 3D static models. The 2D geometry is dynamic, and generated each frame.
Until recently, every time a 2D draw call had to be issued (change in texture, change in blend modes or shader etc), the sprite data generated so far would be uploaded via glbuffersubdata and then rendered. This was fine on iOS, less so on Android.
To improve performance on Android I made the engine put all the 2D geometry into a single data buffer, upload it to a single VBO with one glbuffersubdata call at the start of the next frame, and then execute draw calls using sub-sections of that buffer. This led to a significant boost on Android devices, and made no difference to some of our iOS test devices (eg iPod Touch 6 running iOS10).
However, on a 6S+ running iOS 11, the new pipeline increased the GPU time from a rock-stable 8ms to a wildly-fluctuating 10-14ms, often pushing the game down to 30fps instead of 60. This is not the first time something previously innocuous has become performance-killing with an iOS update.
I've now made the buffering-up a compile option, and regained the lost performance on iOS, but if you are generating significant amounts of dynamic geometry and struggling with performance on iOS11, you may see an improvement if you stop trying to batch glbuffersubdata uploads and instead perform smaller ones interspersed with render calls.
I have a Qt application that is built around a QGraphicsView/Scene. The graphical performance is fine, animations are extremely smooth and a simple high res timer says the frames are drawing as fast as 400 fps. However, the application is always using 15% cpu according to task manager. I have run performance analysis on it in Visual Studio 2012 and it is showing that most of the samples are being taken in the QApplication::notify function.
I have set the viewport to render with a QGLWidget in hopes that offloading the drawing functions to the GPU would help, but that had no impact at all on CPU usage.
Is this normal? Is there something I can do to reduce CPU usage?
Well, there you have it - 400 FPS framerates. That loads one of your cores at 100%. There is a reason people usually cap framerates. The high framerates are putting a strain on the Qt event system which is driving the graphics.
Limit your frame rate to 60 FPS and problem solved.
I'm not updating the view unless an event occurs that updates an
individual graphicswidget
Do not update the scene for each and every scene element change. This is likely the cause of the overhead. You can make multiple scene item changes, but render the scene at a fixed rate.
Also, I notice you said graphicswidget - which I assume is QGraphicsWidget - this might be problematic too. QObject derived classes are a little on the heavy side, and the Qt event system comes with overheads too, which is the reason the regular QGraphicsItem is not QObject derived. If you use graphics widgets excessively, that might be a source of overhead, so see if you can get away with using the lighter QGraphicsItem class and some lighter mechanism to drive your scene.
I am working on Adobe AIR project targeting on mobile devices.
I have a toggle sliding menu that has a hundred items and scrolling feature.
When menu opens on empty screen it's working realy smooth. But the menu behind has an object or vector shapes then fps is slowing down and scroll animation lagging.
There is a sample draw here:
Is there a solution for that?
Don't use any vector on mobile devices. At the minimum, don't display vector and instead draw them into a bitmapdata and display that instead. vector graphics require heavy CPU work and on mobile devices you will reach the CPU limit very fast. So all your displayed graphics have to be at least bitmapdata.
If it's not enough you could also mix with a Stage3D framework like Starling to take care of your background graphics and save even more CPU power.
When using the TransitioningContentControl and a Panorama, I cannot seem to get any good performance when I am navigating from one page to another.
I have been implementing a basic Flip animation, where the current content gets flipped out and the new one is flipped in, but the apps FPS drops to less than 20FPS which means you never get to see the first half of the animation, which is a real pain...
How can I ensure that the animations runs so that the phone can handle the transition?
I dont think its my panorama, its not that full of stuff...
Is this on the emulator or on an actual device? From what i've heard, depending on your hardware, the CPU performance is better on the emulator, but the graphics performance can be much better on an actual device.
Are you transitioning to to the panorama or from the panorama? If you're transitioning to it, can you "delay load" the content of the panorama items' lists?
I'd like to generate a movie in real time with a self-made application doing fast screen captures with part of the screen occupied by a running 3D application.
I'm aware that several applications already exist for this (like FRAPS or Taksi), and even dedicated DirectShow filters (like UScreenCapture), but i really need to make this with my own external application.
When correctly setup (UScreenCapture + ffdshow), capturing an compressing a full screen does not consumes as much CPU as you would expect (about 15%), and does not impairs the performances of the 3D app.
The problem of doing a capture from an external application is that the 3D application loses it's Vsync and creates a shaggy, difficult to use 3D application (3D app is only presented on a small part of the screen, the rest being GDI, DirectX)
FRAPS solves this problem by allowing you to capture only one application at a time (the one with focus). Depending on the technology used (OpenGl, DirectX, GDI), it hooks the Vsync and does its capture (with glReadPixels,...), without perturbing it.
Doing this does not solve my problem, since I want the full composed screen image (including 3D and the rest) AND a smooth 3D app.
The UScreenCapture seems to use a fast DirectX call to capture the whole screen, but the openGL 3D app is still out of sync.
Doing a BitBlt is too slow and CPU consumming to do real time 30 fps acquisition (at least under windows XP, not sure with 7)
My question is to know if there is a way to achieve my goal with Windows 7 and it's brand new DirectX compositing engine?
Windows 7 succeeds to show live VSynced duplicated previews of every app (in the taskbar), so there must be a way to access the currenlty displayed screen buffer without perturbing the rendering of the 3D OpenGL app ?
Any other suggestion, technology ?
thank you
I made a list of possibly useful links at
http://betterlogic.com/roger/?p=3037
let me know if you have any success--eventually I would also be interested in a fast open source screen capture for windows...
related: Fastest method of screen capturing