MCPcopy Create free account
hub / github.com/crownengine/crown / load_metadata_cache

Function load_metadata_cache

src/resource/shader_resource.cpp:1314–1340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1312 }
1313
1314 static bool load_metadata_cache(const DynamicString &cache_key
1315 , CompileOptions &opts
1316 , DynamicString &shader_library
1317 , Vector<UniformMetadata> *uniform_meta
1318 , Vector<ShaderResource::Sampler> *sampler_meta
1319 )
1320 {
1321 if (!hash_map::has(metadata_cache(), cache_key))
1322 return false;
1323
1324 const MetadataCacheEntry cached(default_allocator());
1325 const MetadataCacheEntry &entry = hash_map::get(metadata_cache(), cache_key, cached);
1326
1327 // Cache hits skip opts.read(), so replay source dependencies for invalidation.
1328 for (u32 i = 0; i < vector::size(entry.dependencies); ++i)
1329 opts.fake_read(entry.dependencies[i].c_str());
1330
1331 shader_library = entry.shader_library;
1332
1333 if (uniform_meta != NULL)
1334 *uniform_meta = entry.uniform_meta;
1335
1336 if (sampler_meta != NULL)
1337 *sampler_meta = entry.sampler_meta;
1338
1339 return true;
1340 }
1341
1342 static void store_metadata_cache(const DynamicString &cache_key
1343 , const DynamicString &shader_library

Callers 1

compile_variantFunction · 0.85

Calls 5

getFunction · 0.85
fake_readMethod · 0.80
hasFunction · 0.50
sizeFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected