MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / load

Method load

Source/Engine/Content/Assets/Shader.cpp:31–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31Asset::LoadResult Shader::load()
32{
33 // Special case for Null renderer that doesn't need shaders
34 if (IsNullRenderer())
35 {
36 return LoadResult::Ok;
37 }
38
39 // Load shader cache (it may call compilation or gather cached data)
40 ShaderCacheResult shaderCache;
41 if (LoadShaderCache(shaderCache))
42 {
43 LOG(Error, "Cannot load \'{0}\' shader cache.", ToString());
44 return LoadResult::Failed;
45 }
46 MemoryReadStream shaderCacheStream(shaderCache.Data.Get(), shaderCache.Data.Length());
47
48 // Create shader from cache
49 if (_shader->Create(shaderCacheStream))
50 {
51 LOG(Error, "Cannot load shader \'{0}\'", ToString());
52 return LoadResult::Failed;
53 }
54
55#if COMPILE_WITH_SHADER_COMPILER
56 RegisterForShaderReloads(this, shaderCache);
57#endif
58 return LoadResult::Ok;
59}
60
61void Shader::unload(bool isReloading)
62{

Callers

nothing calls this directly

Calls 4

ToStringFunction · 0.50
GetMethod · 0.45
LengthMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected