UPDATED: Plugin to save/load binary script format

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
CoreDumped
Gremlin
Posts: 177
Joined: Sun Aug 05, 2007 3:55 pm
x 14

Re: Plugin to save/load binary script format

Post by CoreDumped »

Hmm.. I'm in 1.7.2 :?

Will download 1.8 and create another optional plugin that works with the main plugin, by using Assaf's shader cache

Users below 1.8 would still be able to use the main plugin to cache the ogre scripts but without shader cache (since shader cache is 1.8 only)
User avatar
CoreDumped
Gremlin
Posts: 177
Joined: Sun Aug 05, 2007 3:55 pm
x 14

Re: Plugin to save/load binary script format

Post by CoreDumped »

With just a few lines, I was able to use Assaf's Microcode shader cache in the plugin. Its an amazing job done by Assaf. Check out the stats to see what I mean :)

Here is the time taken by the sample browser to startup:
DEBUG MODE:

Code: Select all

Without Plugin          - 7.0648 sec
Script Cache            - 3.8248 sec
Script + Shader Cache   - 2.2292 sec
Image


RELEASE MODE:

Code: Select all

Without Plugin          - 0.9718 sec
Script Cache            - 0.977 sec
Script + Shader Cache   - 0.1454 sec
Image


As you can see, shader compilation is a huge bottleneck in release mode. If you compile the plugin with 1.8, the plugin will automatically use Assaf's shader cache.
With shader cache enabled in release mode, I am not able to see the Sample Browser's loading screen :D

However, in debug mode, it looks like the compiler's script parser is a bottleneck

I also added another plugin project to the trunk for profiling. If you add this plugin to you plugins.cfg, it would create a file SerialzierProfiler.log with the time it took to parse a resource group. This way you can test the loading time with/without the serializer plugin

Code updated to repository
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 100

Re: Plugin to save/load binary script format

Post by Wolfmanfx »

Great i have to try it :)
User avatar
CoreDumped
Gremlin
Posts: 177
Joined: Sun Aug 05, 2007 3:55 pm
x 14

Re: Plugin to save/load binary script format

Post by CoreDumped »

so0os wrote:Hmm... i'd hate to complain, but I didn't get any boot speedup (or a minimal one) from using the plugin, Ogre.log says it skips scripts and processes sbins, but it still takes a year. Am I mising something, or is speedup not the intent here?
If you are using Ogre 1.8, could you try again with the latest code (containing shader cache) and let us know?

P.S.: You will see speedup only on the second try, since the first time u don't have a shader cache available.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: Plugin to save/load binary script format

Post by so0os »

I need the stable thing :( But I hope I'll be able to get microcode cache working with 1.7.2
Sos Sosowski :)
http://www.sos.gd
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 100

Re: Plugin to save/load binary script format

Post by Wolfmanfx »

You forgot to commit ShaderCache files.
User avatar
CoreDumped
Gremlin
Posts: 177
Joined: Sun Aug 05, 2007 3:55 pm
x 14

Re: Plugin to save/load binary script format

Post by CoreDumped »

Wolfmanfx wrote:You forgot to commit ShaderCache files.
Oops forgot to add that to the repo. Done.

Please try now (rev 10)
User avatar
Zonder
Ogre Magi
Posts: 1173
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 76

Re: UPDATED: Plugin to save/load binary script format

Post by Zonder »

It makes scense that the script compilation is slow in debug as the code is debug. But the shaders are compiled with an optimized compiler regardless.

Good job :)
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 100

Re: UPDATED: Plugin to save/load binary script format

Post by Wolfmanfx »

So i compiled it but how to use it now :)
Maybe you should update your wiki with minimal instructions
User avatar
CoreDumped
Gremlin
Posts: 177
Joined: Sun Aug 05, 2007 3:55 pm
x 14

Re: UPDATED: Plugin to save/load binary script format

Post by CoreDumped »

Wolfmanfx wrote:So i compiled it but how to use it now :)
Maybe you should update your wiki with minimal instructions
I'll create a wiki entry soon :)
For now, just paste the plugin dll in your bin folder and register it in plugins.cfg. No need for any code change
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 100

Re: UPDATED: Plugin to save/load binary script format

Post by Wolfmanfx »

So tried but i got no speedup because i am using the RTShaderSystem and this does not use the shader cache stuff but anyway its useful and easy plugable
User avatar
SunSailor
Gnoll
Posts: 699
Joined: Sun Jan 02, 2005 5:45 pm
Location: Velbert, Germany
x 2

Re: Plugin to save/load binary script format

Post by SunSailor »

spookyboo wrote:I would even go so far to move all Ogre scripting stuff to the plugin. Serializing/deserializing is not core functionality of a rendering system.
Why not go even a step further and remove any parsing from the rendering engine at all? XNA does a good job by splitting asset convertion from a whole range of formats and reading the own file formats in the core only.
Online-Distribution with Jade-DS, Ogre-Wrapper included.
Follow me on Twitter for updates!
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: UPDATED: Plugin to save/load binary script format

Post by spacegaier »

Wow, just stumble across this. Awesome job you did here CoreDumped! Will definetly have to check it out once I find the time.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
CoreDumped
Gremlin
Posts: 177
Joined: Sun Aug 05, 2007 3:55 pm
x 14

Re: UPDATED: Plugin to save/load binary script format

Post by CoreDumped »

Zonder wrote:It makes scense that the script compilation is slow in debug as the code is debug. But the shaders are compiled with an optimized compiler regardless.

Good job :)
spacegaier wrote:Wow, just stumble across this. Awesome job you did here CoreDumped! Will definetly have to check it out once I find the time.
Thanks :) Credit also goes out to Assaf Raman for the Shader cache
Wolfmanfx wrote:So tried but i got no speedup because i am using the RTShaderSystem and this does not use the shader cache stuff but anyway its useful and easy plugable
Hmm maybe RTShaderSystem loads the shaders after I save the binary shader cache to disk. I'll save the cache once again while shutting down the plugin and test.
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: UPDATED: Plugin to save/load binary script format

Post by tdev »

Tested it, great work, much faster loading times. However for some users everything turns out grey. Pm me if you want to get a test case.
User avatar
CoreDumped
Gremlin
Posts: 177
Joined: Sun Aug 05, 2007 3:55 pm
x 14

Re: UPDATED: Plugin to save/load binary script format

Post by CoreDumped »

tdev wrote:Tested it, great work, much faster loading times. However for some users everything turns out grey. Pm me if you want to get a test case.
tdev, thanks for pointing it out. The issue was with caching of scripts that had compilation errors. This was fixed by not caching any scripts that have compilation errors. This way scripts that have errors would always be sent back to the parser to be parsed again

Also added a config file for the plugin so you can place the cache folder at an arbitrary location.

Moved the script extension search path to the config file.

Confirmed that the plugin works with third party script formats like *.os, *.pu etc. As long as they use Ogre's script compiler, this should be transparent

Added a new wiki page: http://www.ogre3d.org/tikiwiki/Script+Cache+Plugin
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5505
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1371

Re: UPDATED: Plugin to save/load binary script format

Post by dark_sylinc »

We're trying this plugin and it's awesome. Has a couple mem. leaks on exit, but nothing serious.

First, it's worth noting that if two files have the exact same name in two different folders (i.e. "Path1/MyMaterial.material" & "Path2/MyMaterial.material") the first parsed script will overwrite whatever content is in the parsed files to follow; causing a few bugs if you don't catch them.
Normally the plug-in would read the timestamps and identify them as different, but in some cases (as it happens with installed applications, or with files maintained through subversion) the timestamps will match, and the bug arise

Second, in file ScriptSerializerPlugin.cpp, line 30:

Code: Select all

void ScriptSerializerPlugin::shutdown() {
	OGRE_DELETE mSerializeManager;
}
Should be:

Code: Select all

void ScriptSerializerPlugin::shutdown() {
	OGRE_DELETE mSerializeManager;
	mSerializeManager = 0;
}
Because it's never set to 0, it may crash if the application calls Root::shutdown() twice (which usually happens if shutdown() is called, and later delete mRoot happens)

Thanks again for this wonderful plugin!
Cheers
Alexiss
Halfling
Posts: 74
Joined: Wed Aug 10, 2011 2:11 pm
x 11

Re: UPDATED: Plugin to save/load binary script format

Post by Alexiss »

Awesome plugin, kudos.
Any plan on integrating this in 1.9 ?