MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / Import

Method Import

modules/tools/texture_compiler/src/texture_compiler.cpp:35–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33};
34
35void* STextureImporter::Import(skr_io_ram_service_t* ioService, SCookContext* context)
36{
37 skr::BlobId blob = nullptr;
38 {
39 SkrZoneScopedN("LoadFileDependencies");
40 context->AddFileDependencyAndLoad(ioService, assetPath.c_str(), blob);
41 }
42
43 {
44 SkrZoneScopedN("TryDecodeTexture");
45 // try decode texture
46 const auto uncompressed_data = blob->get_data();
47 const auto uncompressed_size = blob->get_size();
48 EImageCoderFormat format = skr_image_coder_detect_format((const uint8_t*)uncompressed_data, uncompressed_size);
49 if (auto decoder = skr::IImageDecoder::Create(format))
50 {
51 return SkrNew<skr_uncompressed_render_texture_t>(decoder, ioService, blob);
52 }
53 else
54 {
55 SKR_DEFER({blob.reset();});
56 }
57 }
58
59 return nullptr;
60}
61
62void STextureImporter::Destroy(void *resource)
63{

Callers

nothing calls this directly

Calls 7

CreateFunction · 0.50
c_strMethod · 0.45
get_dataMethod · 0.45
get_sizeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected