|
|
|
@ -43,10 +43,10 @@ addShaderProgram(MemoryArena* arena, |
|
|
|
const char* name) |
|
|
|
const char* name) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOGF(Info, "loading shader, %s\n", name); |
|
|
|
LOGF(Info, "loading shader, %s\n", name); |
|
|
|
// TODO: replace std::string w/ utilAllocCStr() ?
|
|
|
|
|
|
|
|
std::string hash_str = std::string(vs) + std::string(fs); |
|
|
|
|
|
|
|
const u32 max_len = 256; |
|
|
|
const u32 max_len = 256; |
|
|
|
u64 hash = utilFNV64a_str(hash_str.substr(0, max_len).c_str()); |
|
|
|
char input_str[max_len]; |
|
|
|
|
|
|
|
snprintf(input_str, max_len, "%s%s", vs, fs); |
|
|
|
|
|
|
|
u64 hash = utilFNV64a_str(input_str); |
|
|
|
|
|
|
|
|
|
|
|
if (getShaderByHash(gl_ctx, hash)) { |
|
|
|
if (getShaderByHash(gl_ctx, hash)) { |
|
|
|
LOGF(Error, "shader is already loaded\n"); |
|
|
|
LOGF(Error, "shader is already loaded\n"); |
|
|
|
|