Vulkan-Samples icon indicating copy to clipboard operation
Vulkan-Samples copied to clipboard

FI: Image Loaders/Encoders/Decoders

Open TomAtkinsonArm opened this issue 3 years ago • 2 comments

What is the Problem?

Image loading is baked into the Scene Graph Image Component constructor. This makes it difficult to use image loaders/encoders and decoders by them selves.

What is the proposed Solution?

Each image third party should be wrapped by a common image loader interface and removed from the Scene Graph.

Images should be placed into the Scene Graph in their usable state and the Graph itself should not control how an image is mutated.

Removing image libraries from the framework will make the creation of platform specific asset pipelines easier in the future. Assets stored in samples should be stored in a raw optimized format and later preprocessed at compile time to be optimal for specific platforms.

A more complex multipurpose image decoder could be created from the existence of lower level decoders and encoders. This would be a stretch goal and is not necessary as part of this improvement

Examples

Data data;
fs.read_file("some_image.png", &data)

Image image;

PNGLoader loader;
loader.read_from_memory(data, &image);

Image encoded_image;

ASTCEncoder encoder;
encoder.encode_to(VK_ASTC_FORMAT, image, &encoded_image);

ASTCDecoder decoder;
decoder.decode_image(encoded_image, &image);

Issues

TomAtkinsonArm avatar Apr 11 '22 18:04 TomAtkinsonArm

Happy to take this on as I have a branch somewhere with this change

TomAtkinsonArm avatar Apr 11 '22 18:04 TomAtkinsonArm