Directory flooding of generated cache shader files Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Directory flooding of generated cache shader files

Post by Lax »

Hi,

When an Ogre application gets started and all resource groups initialized, each time some shader files are created in the application folder:

1610612739PixelShader_ps.hlsl
1610612739VertexShader_vs.hlsl

So when the application is started over and over the folder will be flooded with those files. Is it possible to specify another directory, maybe temp, where those files are created? And what is if the files are never deleted. I tested and started my Ogre application over months and had approx. 500 files placed in the application folder.

Maybe somebody has another idea, how to deal with this cache files?

Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: Directory flooding of generated cache shader files

Post by xrgo »

yes!

Code: Select all

    mHlmsPbs->setDebugOutputPath( true, false, "./hlmsShaders/pbs/" );
set to false to don't generate them
I actually have it like this:

Code: Select all

    Ogre::HlmsCompute* hlmsCompute = Ogre::Root::getSingleton().getHlmsManager()->getComputeHlms();
#ifdef DEVELOPER
    //Enable shader dump, folder must be created first
    QDir().mkdir( "./hlmsShaders/" );
    QDir().mkdir( "./hlmsShaders/pbs/" );
    QDir().mkdir( "./hlmsShaders/unlit/" );
    QDir().mkdir( "./hlmsShaders/compute/" );
    mHlmsPbs->setDebugOutputPath( true, false, "./hlmsShaders/pbs/" );
    mHlmsUnlit->setDebugOutputPath( true, false, "./hlmsShaders/unlit/" );
    hlmsCompute->setDebugOutputPath( true, false, "./hlmsShaders/compute/" );
#else
    mHlmsPbs->setDebugOutputPath( false, false );
    mHlmsUnlit->setDebugOutputPath( false, false );
    hlmsCompute->setDebugOutputPath( false, false );
#endif
so in final release don't create any
Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: Directory flooding of generated cache shader files

Post by Lax »

Wow thanks! I had no clue that its so easy :)

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

User avatar
Ybalrid
Halfling
Posts: 89
Joined: Thu Jul 10, 2014 6:52 pm
Location: France
x 31
Contact:

Re: Directory flooding of generated cache shader files

Post by Ybalrid »

I always wondered why this was turned on by default. I know it can be useful to checkout the shared code generated by the HLMS, but for a "normal user" that isn't hacking around shared code and is just using the built-in PBS/Unlit ones it's more annoying than anything.

I may suggest that this behaviour should be set to "not write debug to disk" when 2.1 will be actually released ^^"
Ogre_glTF Ogre v2-1 GLTF2 loader : topic link github repo
BtOgre21 Fork of btOgre, for Ogre v2-1 : topic link github repo
OIS Current maintainer : Official repository
Annwvyn VR focused game engine using Ogre : https://github.com/Ybalrid/Annwvyn https://annwvyn.org/
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Directory flooding of generated cache shader files

Post by dark_sylinc »

Ybalrid wrote: Sun Nov 19, 2017 2:00 am I always wondered why this was turned on by default. I know it can be useful to checkout the shared code generated by the HLMS, but for a "normal user" that isn't hacking around shared code and is just using the built-in PBS/Unlit ones it's more annoying than anything.
"Normal users" in Ogre3D means other developers; and dumping shader code is highly useful for debugging and knowing what's going on. I'd agree it should be off by default if Ogre3D were a game engine with a GUI editor like Unreal, Unity, or Godot.

Nonetheless, whether it should be on or off as default is still a little subjective.
User avatar
Ybalrid
Halfling
Posts: 89
Joined: Thu Jul 10, 2014 6:52 pm
Location: France
x 31
Contact:

Re: Directory flooding of generated cache shader files

Post by Ybalrid »

I understand the point of view, but I also think that debugging features should be specifically enabled by the user if needed.

Maybe it could the default behavior of just the debug build of the HLMS?

In either case, it's a small thing to toggle it the other, so it's not important. But it seems weird to me to have to turn off the feature, instead of turning it on if I wanted to see the output. ^^"

Also, (apparently like the OP) I thought originially that it was some kind of "cache" used by the HLMS, and not a debugging feature
Ogre_glTF Ogre v2-1 GLTF2 loader : topic link github repo
BtOgre21 Fork of btOgre, for Ogre v2-1 : topic link github repo
OIS Current maintainer : Official repository
Annwvyn VR focused game engine using Ogre : https://github.com/Ybalrid/Annwvyn https://annwvyn.org/
Post Reply