I run "vqenc file.png", file.png is of dimensions 1024x512. No twiddle, no mipmap, just VQ compression.
My program shows a proper texture with "texconv -c -i image.png -o image.vq -f RGB565" (ignoring the first 16 bytes, they're the DTEX header).
Any obvious mistakes? I didn't grasp the whole program quite yet.
Code: Select all
diff --git a/utils/vqenc/vqenc.c b/utils/vqenc/vqenc.c
index bf07146..a72663e 100644
--- a/utils/vqenc/vqenc.c
+++ b/utils/vqenc/vqenc.c
@@ -741,13 +741,13 @@ static int encode(const char *infile) {
return -EINVAL;
} */
- if(image.w != image.h) {
- fprintf(stderr, "%s is not a square image\n", infile);
+ if((use_twiddle || use_mipmap) && image.w != image.h) {
+ fprintf(stderr, "%s is not a square image, it cannot be twiddled or mipmapped\n", infile);
destroy_image(&image);
return -EINVAL;
}
- if(valid_size(image.w) == 0) {
+ if(valid_size(image.w) == 0 || valid_size(image.h) == 0) {
fprintf(stderr, "image dimensions for %s are not valid, see manual\n", infile);
destroy_image(&image);
return -EINVAL;