jansol / texpresso Goto Github PK
View Code? Open in Web Editor NEWA pure Rust texture compression suite
A pure Rust texture compression suite
It appears that, currently, if I want to contol the parallel compressions of multiple textures, the choice is either enable rayon
or reimplement fn compress()
myself. I think it could be done better. For example, compress
could be implemented on top of a helper like this:
fn compress_block_iter() ->impl Iterator<Item = BlockIndex>;
This way, if I want rayon
, I will just convert the regular iterator into sequential with something like into_par_iter().
The advantage here is the following:
The current implementation works purely on RGBA buffers, and also creates an extra copy of each 4x4 chunk as it is being processed. This is not very ideal and it would be nice to refactor things to allow passing in buffers that don't have extra channels as padding, especially now that one- and two-channel formats are supported.
There's some talk in image-rs/image#1495 of using this crate to implement DDS encoding/decoding for image
. The two main things we'd be looking for are support for BC4/BC5 (most of the code already exists for BC3 handling so it would just be a matter of exposing it), and to get a new version published on crates.io. Would you be open to this?
It would be great to implement support for these. I know it's very involved, and also already planned (based on the README). Current alternatives are scarce - basically bind to the monster of Intel Compressonator, which is it's own language and compiler, as well as a giant non-Rust dependency to carry. Has there be any attempt to implement a BC6/BC7 compressor? Even something bare-bones, to iterate on later, would be good.
For the context, I'm happily using texpresso
to cook textures from user facing formats to BCn in Blade. The output of texpresso
is cached on disk, so that loading can be instantaneous - just read from disk into GPU memory without any further processing. Now I need support for environment textures (coming in as EXR), and BC7 is the target. Thank you for the awesome work, and I hope to see texpresso
grow!
At the moment, https://docs.rs/texpresso/2.0.1/texpresso/ describes only a handful of API items, but nothing that would tell me how to actually use this crate.
Could you please try brushing up on it a little - at least make the generator also include undocumented items?
The CLI example application included in the repo is also nice of course - but it was not the first place I went to looking for info on how to make use of Texpresso.
This is sort of a question/discussion issue:
The current function declarations for compressing and decompressing are missing Error
return types or do not specify when they panic in the documentation.
Take the function definition of decompress
as an example:
pub fn decompress(self, data: &[u8], width: usize, height: usize, output: &mut [u8])
It is possible to call this function with invalid parameter combinations, e.g. width
and height
do not match the data
length. With the current definition, only panics are supported without any further detail about what's wrong.
I think the ergonomics could be improved by either adding a return value or at least specifying the situations under which a panic occurs in the documentation. I would prefer the first idea, but I am not sure how exactly the return type should look like. Maybe taking inspiration from image could help.
Context: I am currently trying to fuzz the decompress
function and get panics everywhere.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.