/** * Initializes a program and stores it in the programs hash. If the program already * has been loaded before, the program use count is incremented. * * @param name Name of the shader program. * * @return Shader program. */ Program *loadProgram(String const &name) { if (programs.contains(name)) { programs[name]->useCount++; return programs[name]; } std::unique_ptr<Program> prog(new Program); prog->shaderName = name; prog->def = &ClientApp::shaders()[name].valueAsRecord(); // for lookups later LOG_RES_VERBOSE("Loading model shader \"%s\"") << name; // Bind the mandatory common state. ClientApp::shaders().build(*prog, name); DENG2_FOR_PUBLIC_AUDIENCE2(NewProgram, i) { i->newProgramCreated(*prog); }
void writeIfModified() { if(!file || !arch) return; // If modified, the archive is written back to the file. if(arch->modified()) { LOG_RES_MSG("Updating archive in ") << file->description(); // Make sure we have either a compressed or uncompressed version of // each entry in memory before destroying the source file. arch->cache(); file->clear(); Writer(*file) << *arch; file->flush(); } else { LOG_RES_VERBOSE("Not updating archive in %s (not changed)") << file->description(); } }