Advertisement

really slow software rendering on android with SDL2

Started by May 13, 2016 12:39 PM
3 comments, last by JTippetts 8 years, 7 months ago

Hi all, I am developing a small puzzle game, which I have planned to release on the google play store in the next couple of months.

I have been developing on windows using an SDL2 platform layer, and the game runs pretty well: 50 FPS more or less.

It is my really first "commercial" game, so my hope is to don't have to deal with complicated things linke multithreading and hardware rendering with openGL... for now the game does not make any use of multicore processors, and is software rendered.

Now the problem is that when I ported the app with the NDK, (the code is EXACTLY the same, line by line) and run it on my galaxy S4, I get more or less 18FPS, which of course is not accepltable.

Reading the specific of the S4, I have undestood that it has a quad core processor at 1.9GHZ, while my desktop processor is an AMD Phenom quad-core running at 3ghz.. Could be the difference of frequency the only reason for the FPS drop?

ps: the rendering is done creating a texture with TEXTUREACCESS_STREAMING, then I pass it to the game that fills it pixel by pixel.

buffer->texture = SDL_CreateTexture( renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, width, height );

then the windows update is done with this 4 lines:

SDL_UpdateTexture( buffer->texture, 0, buffer->pixels, buffer->pitch ) );
SDL_Rect destRect = { 0, 0, 540, 960 };
SDL_RenderCopy( renderer, buffer->texture, 0, &destRect );
SDL_RenderPresent( renderer );
Maybe I am doing something wrong in those lines, or maybe I just have to learn OpenGL and multicore programming because the software rendering on android is too slow even for a puzzle game...
Thanks in advance, of course if you need more information ask without any esitations.
Leonardo

There is a lot of information missing to firmly assert a correct answer, but why are you using software rendering? You are placing the entire load on the CPU(which is not optimized for graphics rendering) instead of sharing the graphical resources with the GPU.

Advertisement

To agree with ExErvus, and reiterate the question. Why are you not using the GPU? The S4 has Adreno 320 GPU which support OpenGL 3.0ES and D3D 11.1. You should be looking at offloading the rendering to the hardware over the software. Maybe you are finding your limits with using SDL, or do a little googling and find this https://github.com/grimfang4/sdl-gpu with make instructions.

To agree with ExErvus, and reiterate the question. Why are you not using the GPU? The S4 has Adreno 320 GPU which support OpenGL 3.0ES and D3D 11.1. You should be looking at offloading the rendering to the hardware over the software. Maybe you are finding your limits with using SDL, or do a little googling and find this https://github.com/grimfang4/sdl-gpu with make instructions.

There is a lot of information missing to firmly assert a correct answer, but why are you using software rendering? You are placing the entire load on the CPU(which is not optimized for graphics rendering) instead of sharing the graphical resources with the GPU.

The main reason is that I want to publish the game as soon as possible, because it is "finished", I just need to port it to android, and I was hoping that i would not have needed OpenGL.

With that said, considering the embarassing performance I get on android, I am probably going to catch the opportunity and learn OpenGL, because it is something that I must do anyway, sooner or later.

I just want to know the reason why on my desktop the game runs at 50fps and the same exact code runs at 18fps on the S4.

Please tell me what other information do you need...

Thank you for the link, I will have a look at it.

I just want to know the reason why on my desktop the game runs at 50fps and the same exact code runs at 18fps on the S4.


Because comparing a desktop processor side-by-side with a mobile processor using clock frequency alone is pointless. There are a lot more complicated features of a given processor that go into its overall performance. Mobile processors are very much designed with power efficiency and low heat generation in mind. They have to be, in order for the battery to last more than 30 seconds and in order for the heat output to not burn a hole in your hand.

The desktop processor cares MUCH less about power efficiency and heat dissipation, given its mains power source and the presence of on-board heatsink and cooling fans.

The way I heard it once is that clock frequency is a lot like engine RPM. Even if a 2-cycle weed eater and a turbo-charged Chevy big block 454 are pulling the same number of RPMs, that doesn't mean they're putting out the same amount of horsepower.

This topic is closed to new replies.

Advertisement