mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
Shader Gen to produce ShaderData
Shader gen now produces a shaderdata class - this should reduce full recompilation of shaders when a macro switch happens. FileStream can now also be setup to be async write, so it will write out the file on a separate thread hopefully freeing up the main thread to continue working.
This commit is contained in:
parent
8adf692da5
commit
4cf780e7b8
11 changed files with 337 additions and 126 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include "platform/platform.h"
|
||||
|
||||
#include "core/util/hashFunction.h"
|
||||
#include "core/util/endian.h"
|
||||
|
||||
namespace Torque
|
||||
{
|
||||
|
|
@ -268,4 +269,21 @@ U64 hash64( const U8 *k, U32 length, U64 initval )
|
|||
return c;
|
||||
}
|
||||
|
||||
// Generate a single 64bit hash from the input string.
|
||||
//
|
||||
// Don't get paranoid! This has 1 in 18446744073709551616
|
||||
// chance for collision... it won't happen in this lifetime.
|
||||
//
|
||||
String getStringHash64(const String& in)
|
||||
{
|
||||
String cacheKey = in;
|
||||
cacheKey.replace("\n", " ");
|
||||
U64 hash = hash64((const U8*)cacheKey.c_str(), cacheKey.length(), 0);
|
||||
hash = convertHostToLEndian(hash);
|
||||
U32 high = (U32)(hash >> 32);
|
||||
U32 low = (U32)(hash & 0x00000000FFFFFFFF);
|
||||
cacheKey = String::ToString("%x%x", high, low);
|
||||
return cacheKey;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ extern U32 hash(const U8 *k, U32 length, U32 initval);
|
|||
|
||||
extern U64 hash64(const U8 *k, U32 length, U64 initval);
|
||||
|
||||
extern String getStringHash64(const String& in);
|
||||
|
||||
}
|
||||
|
||||
#endif // _HASHFUNCTION_H_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue