Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing gl state is not a good thing #295

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

changing gl state is not a good thing #295

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: All, Other

Comments on the original bug report:

On 2010-07-16 19:09:28 +0000, Vittorio Giovara wrote:

i was reading SDL_renderer_gles and i noticed that every time we there
is some gl call the gl state is modified with a couple of
glEnableClientState()/glDisableClientState.
While this is completely fine for desktops systems, this is a major
performace kill on mobile devices, right where opengles is
implemented.
Normal practice in this case is to update the glstate once, keep it
always the same and disable/enable other states only in very special
occasions.

On the web there's plenty of documentation (on the top of my head
http://developer.apple.com/iphone/library/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Performance/Performance.html#//apple_ref/doc/uid/TP40008793-CH105-SW5
) and i personally tried this.
I modified my code and got a 10 fps boost, then modified SDL_render_gles and shifted from 40 fps to 50 fps alone -- considering that i started from ~30fps i got an 80% performance increase with this technique.

I have attached a dif of my changes, hope that it will be included in mainstream.

On 2010-07-16 19:39:14 +0000, Vittorio Giovara wrote:

Created attachment 520
patch that implements this feature

On 2010-07-16 19:40:08 +0000, Sam Lantinga wrote:

Thank you very much for your patch for SDL 1.3!

Do you give me permission to release your code with SDL 1.3 and future
versions of SDL under both the LGPL and a closed-source commercial
license?

On 2010-07-16 19:43:38 +0000, Vittorio Giovara wrote:

sure, no problem.

On 2010-07-16 19:53:06 +0000, Sam Lantinga wrote:

Thanks! :)

On 2010-07-21 00:27:07 +0000, Sam Lantinga wrote:

There was some question about whether we should enable/disable GL_TEXTURE_COORD_ARRAY. Were you able to determine whether your patch was safe in that regard?

On 2010-07-21 01:27:44 +0000, Vittorio Giovara wrote:

(In reply to comment # 5)

There was some question about whether we should enable/disable
GL_TEXTURE_COORD_ARRAY. Were you able to determine whether your patch was safe
in that regard?

well by testing against the sdl demos, only the fireworks caused glitches (where by glitch i mean crash) and enabling or disabling othe gl states didn't change the result.
In our app we use opengles directly so this worked well as we have more control. Perhaps you leave this frequent gl switch on by default (for compatibility) and then add an api that freezes the state,

On 2011-01-19 23:56:46 +0000, Sam Lantinga wrote:

This is fixed, thanks!
http://hg.libsdl.org/SDL/rev/b5b42be9333c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant