The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
major fps drop with SDL 1.3
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
Yesterday I recompiled a project I am working to make it use SDL 1.3 instead of 1.2.14 and my FPS dropped from over 80 to about 13. Is this normal? Should I rewrite my code to use SDL_Textures instead of SDL_Surfaces?
Urmel


Joined: 28 Dec 2009
Posts: 5
Yes, use SDL_Textures, otherwise you aren't really using the new API.
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
1. Does this mean that all libraries created for SDL < 1.3 (like Guichan) will work sub-optimally also?
2. It is possible to mix a SDL_Surface + SDL_BlitSurface code with SDL_Textures and SDL_RenderCopy?
major fps drop with SDL 1.3
Ken Rogoway
Guest

I saw a similar thing recompiling my 1.2.14 based game with 1.3, the frame rate dropped 50%. I switched to using the new API and the frame rate jumped from 20 FPS to 400 FPS. I’d definitely recommend switching to the new API.

Sam is aware of the frame rate drop using the old API. I have provided him with the code and assets for my game so he can see it firsthand. I’m sure he will get to it when he has time.

Ken

From: [mailto:] On Behalf Of hardcoder
Sent: Wednesday, January 06, 2010 6:16 AM
To:
Subject: [SDL] major fps drop with SDL 1.3



Yesterday I recompiled a project I am working to make it use SDL 1.3 instead of 1.2.14 and my FPS dropped from over 80 to about 13. Is this normal? Should I rewrite my code to use SDL_Textures instead of SDL_Surfaces?
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
I already started to rewrite game rendering parts to use new API and as you say, for things that work already FPS is about 5x SDL 1.2 version and about 2x glSDL version. Seems that free lunch is not yet completely over Wink
major fps drop with SDL 1.3
Vittorio G.
Guest

umh, is there a tutorial or a list of "what to do" for updating to the new API?
beside this link http://zeeky-h-bomb.blogspot.com/2008/10/sdl-window.html which can be summarized in

SDL_VideoInit instead of SDL_Init
SDL_CreateWindow instad of SDL_SetVideoMode
SDL_CreateRenderer and SDL_SelectRenderer instead of (i don't know)
SDL_RenderFill instad of SDL_FillRect

what other kind of documentation we have?
what would you add to the list of new api above?
Vittorio

On Sun, Jan 10, 2010 at 12:31 PM, hardcoder wrote:
Quote:
I already started to rewrite game rendering parts to use new API and as you say, for things that work already FPS is about 5x SDL 1.2 version and about 2x glSDL version. Seems that free lunch is not yet completely over [img][/img]


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--

Samuel Goldwyn  - "I don't think anyone should write their autobiography until after they're dead."
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
I finished updating my application to the new API and I now I think I mat not have been the right choice. The only renderer that produces correct output is d3d (creating opengl renderer crashes the app as reported in other post), and I actually hoped that user would be able to choose from 4 render drivers listed. On top of that FPS dropped by 50% (!!!) compared to SDL 1.2 + glSDL backend. I still hope that conversion was not a wasted time and this is just me doing something wrong. Is there any docs / faq / etc to point to efficient use of a renderer?
How to display a decoded frame?
Aveek Adhya
Guest

Hi all,

I am a newbie in SDL programming. I have got a decoded video frame. I just want to display the decoded frame using SDL. Is that sequence of API call (with appropriate parametes) enough for the display?

SDL_Init()
SDL_SetVideoMode()
SDL_CreateYUVOverlay()

SDL_LockYUVOverlay()
memcpy(...)
SDL_UnlockYUVOverlay()
SDL_DisplayYUVOverlay()

SDL_FreeSurface()
SDL_FreeYUVOverlay()
SDL_Quit()

Any sample example to display frame using overlay ?

Thanks...
major fps drop with SDL 1.3
Christoph Nelles
Guest

Looks like the mail2forum software messed this up. I got his mail
correctly under the topic "[SDL] How to display a decoded frame?"

On Thu, 14 Jan 2010 07:17:43 -0800, "hardcoder" wrote:
Quote:
And how is this related to the thread?


Aveek Adhya wrote:
Quote:
Hi all,

I am a newbie in SDL programming. I have got a decoded video frame. I
just want to display the decoded frame using SDL. Is that sequence of
API
Quote:
Quote:
call (with appropriate parametes) enough for the display?

SDL_Init()
SDL_SetVideoMode()
SDL_CreateYUVOverlay()

SDL_LockYUVOverlay()
memcpy(...)
SDL_UnlockYUVOverlay()
SDL_DisplayYUVOverlay()

SDL_FreeSurface()
SDL_FreeYUVOverlay()
SDL_Quit()

Any sample example to display frame using overlay ?

Thanks...

--
Christoph Nelles

E-Mail :
Jabber : ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: major fps drop with SDL 1.3
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
And again, it is under FPS issues with SDL 1.3.

Christoph Nelles wrote:
Looks like the mail2forum software messed this up. I got his mail
correctly under the topic "[SDL] How to display a decoded frame?"

On Thu, 14 Jan 2010 07:17:43 -0800, "hardcoder" wrote:
Quote:
And how is this related to the thread?


Aveek Adhya wrote:
Quote:
Hi all,

I am a newbie in SDL programming. I have got a decoded video frame. I
just want to display the decoded frame using SDL. Is that sequence of
API
Quote:
Quote:
call (with appropriate parametes) enough for the display?

SDL_Init()
SDL_SetVideoMode()
SDL_CreateYUVOverlay()

SDL_LockYUVOverlay()
memcpy(...)
SDL_UnlockYUVOverlay()
SDL_DisplayYUVOverlay()

SDL_FreeSurface()
SDL_FreeYUVOverlay()
SDL_Quit()

Any sample example to display frame using overlay ?

Thanks...

--
Christoph Nelles

E-Mail :
Jabber : ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
major fps drop with SDL 1.3
Ken Rogoway
Guest

I also saw a 50% drop when using SDL 1.3, but with the old API. When I switched to using Textures and the default renderer I saw a 10x speed increase (to 400 FPS).

From: [mailto:] On Behalf Of hardcoder
Sent: Thursday, January 14, 2010 5:06 AM
To:
Subject: Re: [SDL] major fps drop with SDL 1.3



I finished updating my application to the new API and I now I think I mat not have been the right choice. The only renderer that produces correct output is d3d (creating opengl renderer crashes the app as reported in other post), and I actually hoped that user would be able to choose from 4 render drivers listed. On top of that FPS dropped by 50% (!!!) compared to SDL 1.2 + glSDL backend. I still hope that conversion was not a wasted time and this is just me doing something wrong. Is there any docs / faq / etc to point to efficient use of a renderer?
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
Any chance for a help here?
major fps drop with SDL 1.3
Ken Rogoway
Guest

Are you using the new API, or just the new version of SDL? If you are using SDL_Blit functions then you are using the old API and as I stated in a prior post this results in a 50% slowdown. Sam is aware of the issue and I have given him access to my game to demonstrate the issue. However, if you are using the SDL_Render functions then you are using the new API and you should see a dramatic increase in performance.

Here is a code snippet for my startup with the new SDL 1.3 video API:

SDL_DisplayMode fullscreen_mode;

SDL_zero( fullscreen_mode );

fullscreen_mode.format = SDL_PIXELFORMAT_RGB24;

m_nWindowID = SDL_CreateWindow(
pName,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
g_nDisplayWidth,
g_nDisplayHeight,
SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL );

if ( m_nWindowID )
{
int nResult;

nResult = SDL_SetWindowDisplayMode( m_nWindowID, &fullscreen_mode );

SDL_ShowWindow( m_nWindowID );

nResult = SDL_CreateRenderer( m_nWindowID,-1,SDL_RENDERER_PRESENTCOPY );

nResult = SDL_SelectRenderer( m_nWindowID );

// Set the draw color to black
nResult = SDL_SetRenderDrawColor( 0x00, 0x00, 0x00, 0xFF );

// Fill the screen with black
nResult = SDL_RenderClear();
}

I do NOT call this, because if you do then it will block events. There is a bug in the database with a sample to show this:

// Do NOT call this or SDL will block all events
if ( cKS_Game::g_bCallVideoInit )
{
int nResult = SDL_VideoInit( NULL,0 );

if ( nResult < 0 )
{
KS_LOGTRACE( "ERROR: Couldn't initialize video driver: %s\n", SDL_GetError() );
return false;
}

SDL_SelectVideoDisplay( 0 );
}




From: [mailto:] On Behalf Of hardcoder
Sent: Thursday, January 14, 2010 1:20 PM
To:
Subject: Re: [SDL] major fps drop with SDL 1.3



Any chance for a help here?
Re: major fps drop with SDL 1.3
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
Ken Rogoway wrote:
Are you using the new API, or just the new version of SDL? If you are using SDL_Blit functions then you are using the old API and as I stated in a prior post this results in a 50% slowdown. Sam is aware of the issue and I have given him access to my game to demonstrate the issue. However, if you are using the SDL_Render functions then you are using the new API and you should see a dramatic increase in performance.
Any chance for a help here?


As mentioned before, I already rewrote my in-progress game to the new API. My init code is virtually the same, and surfaces are now used as arguments to SDL_CreateTextureFromSurface. To be sure that I am not using anything deprecated I additionally defined SDL_NO_COMPAT. Also, as previously stated, it is not FPS drop compared to SDL 1.2 but to SDL 1.2 with glSDL as rendering backed, which I think is necessary to explain is an SDL drawing backed that uses OpenGL hardware driver to perform fake blitting same way it is now in SDL 1.3 (http://olofson.net/mixed.html). On my laptop (crap intel graphis) transition from glSDL to proper SDL 1.3 resulted in exact same FPS, on the other hand on my main machine with GeForce 9800 GTX+ fps dropped from 800 to 400.

btw. I don't think SDL_WINDOW_OPENGL flag is needed when using SDL_Render API, but only when making dedicated, OpenGL context based app.
major fps drop with SDL 1.3
Sam Lantinga


Joined: 10 Sep 2009
Posts: 1765
Do you have some test cases for this? I have some time to look at
this, but I don't see any bugs in bugzilla or any examples I can use
to reproduce these problems.

Thanks!

On Thu, Jan 14, 2010 at 3:06 AM, hardcoder wrote:
Quote:
I finished updating my application to the new API and I now I think I mat
not have been the right choice. The only renderer that produces correct
output is d3d (creating opengl renderer crashes the app as reported in other
post), and I actually hoped that user would be able to choose from 4 render
drivers listed. On top of that FPS dropped by 50% (!!!) compared to SDL 1.2
+ glSDL backend. I still hope that conversion was not a wasted time and this
is just me doing something wrong. Is there any docs / faq / etc to point to
efficient use of a renderer?
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





--
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org