/** * Function for initialization. */ GLUSboolean init(GLUSvoid) { try { RequreExtentions(); g_programCompute = ComputeProgram("../main/Compute.glsl"); computeTest(g_programCompute.program); return GLUS_TRUE; } catch(std::runtime_error e) { std::cerr << e.what() << std::endl; exit(-1); } catch(...) { std::cerr << "Unexpected Exception (init)!" << std::endl; exit(-1); } }
DefaultResources::DefaultResources(DevicePtr dptr) : _spirv(std::make_unique<SpirVData[]>(spirv_count)), _computes(std::make_unique<ComputeProgram[]>(compute_count)), _materials(std::make_unique<AssetPtr<Material>[]>(material_count)) { for(usize i = 0; i != spirv_count; ++i) { _spirv[i] = load_spirv(spirv_names[i]); } for(usize i = 0; i != compute_count; ++i) { _computes[i] = ComputeProgram(ComputeShader(dptr, _spirv[usize(compute_spirvs[i])])); } for(usize i = 0; i != material_count; ++i) { const auto& data = material_datas[i]; _materials[i] = make_asset<Material>(dptr, MaterialData() .set_frag_data(_spirv[data.frag]) .set_vert_data(_spirv[data.vert]) .set_depth_tested(data.depth_tested) .set_culled(data.culled) .set_blended(data.blended) ); } }