PERFORMANCE: Reuse of same Program3D throughout.

Discuss suggestions to improve the Axel library.

PERFORMANCE: Reuse of same Program3D throughout.

Postby chamberlainpi » Fri Apr 27, 2012 7:01 pm

Similarly how you've got a system to cache Texture resources, it might be beneficial to store the Program3D objects somewhere centralized, and perhaps even have one as the default.

Where I'm getting at with this - is that instead of assigning the same shader instructions in separate Program3D objects, you could have one, and check which one is currently assign on the context. If the shader of a particular model requires a different Program3D, just switch it as you do now. But if it's the same as the previous drawing passes, just leave it as is.

Not sure it will improve tons of performance, but I figure any GPU state changes can probably help! :)
chamberlainpi
Master Sergeant
 
Posts: 32
Joined: Thu Apr 05, 2012 8:51 am
Location: Fredericton, NB

Re: PERFORMANCE: Reuse of same Program3D throughout.

Postby Arkeus » Fri Apr 27, 2012 7:11 pm

I currently actually do share programs across everything (all sprites have the same AxShader which points to the same shader). Also, I've already made this performance optimization for the next version. On my desktop it didn't help much (I added tons of sprites to bring down the fps to 52, and when I made this change it bumped it up to 55-56), however, I would expect it will help more on mobile devices. :)

Until I have a stable version with all the stuff I want in it, I don't have a good way of sharing incremental changes like this, since I'd rather not have a pre-beta branch on github, but hopefully in the future things like this will get to users faster. :)
Image
User avatar
Arkeus
Site Admin
 
Posts: 363
Joined: Mon Mar 26, 2012 12:43 am

Re: PERFORMANCE: Reuse of same Program3D throughout.

Postby chamberlainpi » Fri Apr 27, 2012 7:29 pm

Oh great! My bad... I didn't notice you used AxCache deeper in AxModel, which is probably where your shader gets reused.

It is getting kinda late here haha, I'll blame it on being tired.
chamberlainpi
Master Sergeant
 
Posts: 32
Joined: Thu Apr 05, 2012 8:51 am
Location: Fredericton, NB


Return to Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest

cron