Skip to content

Commit fff5cb7

Browse files
committed
Consider no mipmaps present when mipmap count is 1
that is correct, although somewhat unlogical imo
1 parent 874f20c commit fff5cb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void dds2tex(const char* dds_path)
5151
fclose(dds_file);
5252
return;
5353
}
54-
if (dds_header.dwMipMapCount > 0) {
54+
if (dds_header.dwMipMapCount > 1) { // this value may be set to 1, which is equivalent to leaving it at 0 (no mipmaps)
5555
if (dds_header.dwMipMapCount != 32u - __builtin_clz(max(dds_header.dwWidth, dds_header.dwHeight))) {
5656
fprintf(stderr, "Error: DDS mipmap count mismatch; expected %u mipmaps, got %u\n", 32 - __builtin_clz(max(dds_header.dwWidth, dds_header.dwHeight)), dds_header.dwMipMapCount);
5757
fclose(dds_file);
@@ -74,7 +74,7 @@ void dds2tex(const char* dds_path)
7474
.magic = tex_magic,
7575
.image_width = dds_header.dwWidth,
7676
.image_height = dds_header.dwHeight,
77-
.has_mipmaps = dds_header.dwMipMapCount
77+
.has_mipmaps = dds_header.dwMipMapCount > 1
7878
};
7979
memcpy(tex_header.tex_format, tex_format, 2);
8080
fwrite(&tex_header, sizeof(TEX_HEADER), 1, tex_file);

0 commit comments

Comments
 (0)