- string source = create_program_source();
- string name = format("_material_%016x.glsl", hash64(source));
- Program *shprog = coll.find<Program>(name);
+ string module_name;
+ map<string, int> spec_values;
+ if(alpha_cutoff>0.0f)
+ spec_values["use_alpha_cutoff"] = true;
+
+ fill_program_info(module_name, spec_values);
+
+ for(const auto &kvp: extra_spec)
+ spec_values[kvp.first] = kvp.second;
+
+ uint64_t info_hash = hash<64>(module_name);
+ for(const auto &kvp: spec_values)
+ {
+ info_hash = hash_update<64>(info_hash, kvp.first);
+ info_hash = hash_update<64>(info_hash, kvp.second);
+ }
+
+ Resources &res = Resources::get_global();
+ string name = format("_material_%016x.shader", info_hash);
+ Program *shprog = res.find<Program>(name);