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

Method compile

src/resource/shader_resource.cpp:2334–2365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2332 }
2333
2334 s32 compile()
2335 {
2336 Buffer variants(default_allocator());
2337 FileBuffer fb(variants);
2338
2339 // Write header.
2340 _opts.write(RESOURCE_HEADER(RESOURCE_VERSION_SHADER));
2341
2342 // Write variants.
2343 _opts.write(vector::size(_static_compile));
2344
2345 for (u32 ii = 0; ii < vector::size(_static_compile); ++ii) {
2346 const StaticCompile &sc = _static_compile[ii];
2347 const DynamicString &shader = sc._shader;
2348 const Vector<DynamicString> &defines = sc._defines;
2349
2350 cache_shader_library(shader, _shader_library);
2351
2352 RETURN_IF_FALSE(SHADER_RESOURCE, hash_map::has(_shaders, shader)
2353 , _opts
2354 , "Unknown shader: '%s'"
2355 , shader.c_str()
2356 );
2357
2358 s32 err = compile_variant(fb, NULL, NULL, shader, defines, false);
2359 ENSURE_OR_RETURN(SHADER_RESOURCE, err == 0, _opts);
2360 }
2361
2362 _opts.write(variants);
2363
2364 return 0;
2365 }
2366
2367 // Collects code from @a shader and its includes recursively.
2368 s32 bgfx_shader_collect_code(StringStream &code, const BgfxShader &shader)

Callers 1

compileFunction · 0.45

Calls 6

cache_shader_libraryFunction · 0.85
compile_variantFunction · 0.85
sizeFunction · 0.50
hasFunction · 0.50
writeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected