1#include "shader_library.h"
6shader_library::shader_library() {
11shader_library::~shader_library() {
16void shader_library::clear(context& ctx) {
21bool shader_library::add(
const std::string& name,
const std::string& file,
const shader_define_map& defines) {
23 if(shaders.find(name) == shaders.end()) {
26 elem.defines = defines;
27 shaders.insert({ name, elem });
33bool shader_library::load_all(context& ctx,
const std::string& where) {
36 for(
auto& elem : shaders) {
37 shader_info& si = elem.second;
38 success &= load(ctx, si.prog, si.filename, si.defines,
true, where);
44bool shader_library::reload(context& ctx,
const std::string& name,
const shader_define_map& defines,
const std::string& where) {
46 auto it = shaders.find(name);
47 if(it != shaders.end()) {
48 shader_info& si = (*it).second;
50 return load(ctx, si.prog, si.filename, si.defines,
true, where);
55bool shader_library::reload_all(context& ctx,
const std::string& where) {
58 for(
auto& elem : shaders) {
59 shader_info& si = elem.second;
60 success &= load(ctx, si.prog, si.filename, si.defines,
true, where);
std::map< std::string, std::string > shader_define_map
typedef for shader define map data structure