Page 1 of 1

Case sensitivity causes loading same texture twice

Posted: Fri Aug 04, 2017 1:49 pm
by Oogst
I've noticed that if I set the same texture twice but with different casing, then the texture will be loaded twice. Or at least the loading time will happen twice. So if I do this, I get loading time twice:

Code: Select all

textureUnitStateA->setTextureName("Banana.tga");
textureUnitStateB->setTextureName("banana.tga");
However, if I use the same case then only the first call incurs loading time, as expected:

Code: Select all

textureUnitStateA->setTextureName("banana.tga");
textureUnitStateB->setTextureName("banana.tga");
This is on Windows in Ogre 1.9RC. Has this behaviour changed since then?

I can imagine this makes sense on Linux/Mac where the file system is case sensitive, but on Windows Ogre is simply loading the exact same texture twice. Is there some way to fix this? I don't know whether under the hood the memory is also used twice or whether it just reloads and overwrites the previous texture.

My current workaround for this behaviour is to just always convert my texture names to lower case before sending them to Ogre. However, this requires that I think of this at all times, so it's a rather bug-prone solution.

Re: Case sensitivity causes loading same texture twice

Posted: Fri Aug 04, 2017 2:13 pm
by paroj
Oogst wrote: My current workaround for this behaviour is to just always convert my texture names to lower case before sending them to Ogre. However, this requires that I think of this at all times, so it's a rather bug-prone solution.
This is exactly what Ogre would do:
https://github.com/OGRECave/ogre/blob/b ... .cpp#L1852

you could check if your archive returns false for isCaseSensitive() as it should:
https://github.com/OGRECave/ogre/blob/m ... em.cpp#L71

anyway with 1.10 Ogre case insensitivity is deprecated:
https://github.com/OGRECave/ogre/blob/m ... trict-mode

besides performance, the idea is that Ogre should promote cross-platform compatibility.

Re: Case sensitivity causes loading same texture twice

Posted: Fri Aug 04, 2017 5:33 pm
by Oogst
Thanks for clearing up how it's intended in Ogre! :)
paroj wrote:...
anyway with 1.10 Ogre case insensitivity is deprecated:
https://github.com/OGRECave/ogre/blob/m ... trict-mode

besides performance, the idea is that Ogre should promote cross-platform compatibility.
I guess an engine shouldn't change it's policy randomly over the years, but I do disagree with this choice pretty strongly. Over the years I've run into so many bugs due to case sensitivity that at my company we now have the basic rule that nothing should ever be case sensitive. It's just super confusing for humans to work with, especially when working in a larger team with artists and designers.

It's possible for an engine to be cross-platform compatible without being case sensitive. The engine we've made for Awesomenauts and Swords & Soldiers runs on PC/Mac/Linux/PS3/PS4/360/X1/Wii/WiiU/iOS/Android and files are not case sensitive. However, this does mean either doing a lookup to correct case sensitivity, or removing all casing during the asset build process.

Anyway, thanks again for explaining how it works in Ogre! :)