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

Function load

src/resource/texture_resource.cpp:26–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace texture_resource_internal
25{
26 void *load(File &file, Allocator &a)
27 {
28 BinaryReader br(file);
29
30 u32 version;
31 br.read(version);
32 CE_ASSERT(version == RESOURCE_HEADER(RESOURCE_VERSION_TEXTURE), "Wrong version");
33
34 u32 size;
35 br.read(size);
36
37 TextureResource *tr = (TextureResource *)a.allocate(sizeof(TextureResource) + size);
38
39 void *data = &tr[1];
40 br.read(data, size);
41
42 tr->mem = bgfx::makeRef(data, size);
43 tr->handle.idx = BGFX_INVALID_HANDLE;
44
45 return tr;
46 }
47
48 void online(StringId64 id, ResourceManager &rm)
49 {

Callers

nothing calls this directly

Calls 3

makeRefFunction · 0.85
readMethod · 0.45
allocateMethod · 0.45

Tested by

no test coverage detected