From 1d4488d79917b6b47ae3f0d705486a5b873e8dea Mon Sep 17 00:00:00 2001 From: hgn Date: Fri, 15 Apr 2022 02:31:23 +0100 Subject: [PATCH 1/1] Wrong uncompressed formats... oops --- Makefile | 5 ++++- __init__.py | 8 ++++---- nbvtf/vtf_cmd.c | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8d62488..dea01c8 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,10 @@ libcxr.so: cxr/cxr.h cxr/cxr_math.h cxr/cxr_mem.h -lm tovtf: nbvtf/obj/librgbcx.o nbvtf/obj/tovtf.o - g++ -O3 nbvtf/obj/tovtf.o nbvtf/obj/librgbcx.o -o tovtf + g++ -O3 \ + -Wno-unused-variable -Wno-unused-function -fsanitize=address -Werror=vla \ + nbvtf/obj/tovtf.o nbvtf/obj/librgbcx.o \ + -o tovtf nbvtf/obj/librgbcx.o: nbvtf/librgbcx.cc nbvtf/rgbcx.h g++ -O3 -c \ diff --git a/__init__.py b/__init__.py index b926763..4fc3eed 100644 --- a/__init__.py +++ b/__init__.py @@ -470,8 +470,8 @@ def libcxr_line_callback( p0,p1,colour ): libnbvtf = None # Constants -NBVTF_IMAGE_FORMAT_RGBA8888 = 0 -NBVTF_IMAGE_FORMAT_RGB888 = 2 +NBVTF_IMAGE_FORMAT_ABGR8888 = 1 +NBVTF_IMAGE_FORMAT_BGR888 = 3 NBVTF_IMAGE_FORMAT_DXT1 = 13 NBVTF_IMAGE_FORMAT_DXT5 = 15 NBVTF_TEXTUREFLAGS_CLAMPS = 0x00000004 @@ -1048,10 +1048,10 @@ def compile_image(img): dims = img.cxr_data.export_res fmt = { - 'RGBA': NBVTF_IMAGE_FORMAT_RGBA8888, + 'RGBA': NBVTF_IMAGE_FORMAT_ABGR8888, 'DXT1': NBVTF_IMAGE_FORMAT_DXT1, 'DXT5': NBVTF_IMAGE_FORMAT_DXT5, - 'RGB': NBVTF_IMAGE_FORMAT_RGB888 + 'RGB': NBVTF_IMAGE_FORMAT_BGR888 }[ img.cxr_data.fmt ] mipmap = img.cxr_data.mipmap diff --git a/nbvtf/vtf_cmd.c b/nbvtf/vtf_cmd.c index 1fc5536..d501279 100644 --- a/nbvtf/vtf_cmd.c +++ b/nbvtf/vtf_cmd.c @@ -126,7 +126,8 @@ int main( int argc, char *argv[] ) printf( "tovtf: Creating vtf with format '%s'\n", vtf_format_strings[ format ] ); auto_output( path_source, dest ); - nbvtf_convert( path_source, 0, 0, 1, format, 0x00, dest ); + nbvtf_init(); + nbvtf_convert( path_source, 0, 0, 1, format, 16, 0x00, dest ); return 0; } -- 2.25.1