MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / PreloadForDrawType

Method PreloadForDrawType

Source/Main/scenegraph.cpp:2954–2994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2952}
2953
2954void SceneGraph::PreloadForDrawType(std::map<std::string, int>& preload_shaders, PreloadType type) {
2955 Shaders* shaders = Shaders::Instance();
2956 Object::DrawType draw_type;
2957 switch (type) {
2958 case kDrawDepthOnly:
2959 draw_type = Object::kDrawDepthOnly;
2960 break;
2961 case kDrawAllShadowCascades:
2962 draw_type = Object::kDrawAllShadowCascades;
2963 break;
2964 case kDrawDepthNoAA:
2965 draw_type = Object::kDrawDepthNoAA;
2966 break;
2967 case kFullDraw:
2968 draw_type = Object::kFullDraw;
2969 break;
2970 case kWireframe:
2971 draw_type = Object::kWireframe;
2972 break;
2973 case kDecal:
2974 draw_type = Object::kDecal;
2975 break;
2976 default:
2977 return;
2978 }
2979
2980 UpdateShaderSuffix(this, draw_type);
2981 for (auto& preload_shader : preload_shaders) {
2982 if (preload_shader.second & type) {
2983 const int kShaderStrSize = 1024;
2984 char buf[kShaderStrSize];
2985 FormatString(buf, kShaderStrSize, "%s %s", preload_shader.first.c_str(), global_shader_suffix);
2986 Shaders::OptionalShaders optional = Shaders::kNone;
2987 if (preload_shader.second & kOptionalGeometry)
2988 optional = Shaders::kGeometry;
2989 else if (preload_shader.second & kOptionalTessellation)
2990 optional = Shaders::kTesselation;
2991 shaders->createProgram(shaders->returnProgram(buf, optional));
2992 }
2993 }
2994}
2995
2996void SceneGraph::PreloadShaders() {
2997 LOGI << "Preloading shaders..." << std::endl;

Callers

nothing calls this directly

Calls 4

UpdateShaderSuffixFunction · 0.85
FormatStringFunction · 0.85
returnProgramMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected