KhronosGroup / Vulkan-Samples

One stop solution for all Vulkan samples
Apache License 2.0
4.23k stars 634 forks source link

FI: Image Loaders/Encoders/Decoders #437

Closed TomAtkinsonArm closed 1 month ago

TomAtkinsonArm commented 2 years ago

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 commented 2 years ago

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

SaschaWillems commented 4 months ago

Do we still want to do this? Or should we go the glTF route and only support what glTF has to offer?

SaschaWillems commented 1 month ago

Closing this for now. I don't think we're going to implement this.