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:
marauder2k7 2026-06-05 11:29:18 +01:00
parent 8adf692da5
commit 4cf780e7b8
11 changed files with 337 additions and 126 deletions

View file

@ -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

View file

@ -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_