Skip to content

Commit 959ce90

Browse files
authored
updated pvrtex tool to version 2, per the latest release from TapamN (KallistiOS#1145)
Co-authored-by: drxl <daniel@vmap.dk> https://dcemulation.org/phpBB/viewtopic.php?p=1061943#p1061943
1 parent efd7da8 commit 959ce90

36 files changed

Lines changed: 3851 additions & 784 deletions

utils/pvrtex/CHANGELOG

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
11
Based on code by TapamN
22
Source released here: https://dcemulation.org/phpBB/viewtopic.php?t=106138
33

4-
Version 1.0
5-
Initial release
4+
Version 2.00
5+
Mipmaps can now be generationed optionally only if
6+
texture is already square, using "--mip-resize opt".
7+
8+
.PVR and .DT files can be used as input files.
9+
10+
Custom palettes can be specified with --palette option.
11+
12+
Option to generate texconv style normal maps.
13+
14+
Added flip-v option.
15+
16+
Texture size is printed when --verbose is enabled.
17+
18+
Speed optimizations.
619

720
Version 1.01
8-
Program now displays error message when an error occurs loading a source image. Previously, the program would hit an assertion.
21+
Program now displays error message when an error occurs
22+
loading a source image. Previously, the program would
23+
hit an assertion.
924

10-
Fixed "--resize down" option. Previously, the program would round down sizes that were already a power-of-two, now sizes that are already POT are left unchanged.
25+
Fixed "--resize down" option. Previously, the program
26+
would round down sizes that were already a power-of-two,
27+
now sizes that are already POT are left unchanged.
1128

1229
Included a missing FFmpeg header file.
1330

31+
Version 1.0
32+
Initial release
1433
---------------------------
1534

1635
Adaption into KOS by Daniel Fairchild, 2024

utils/pvrtex/Makefile

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,18 @@
44
TARGET = pvrtex
55
OBJS = elbg.o mem.o log.o bprint.o avstring.o lfg.o crc.o md5.o stb_image_impl.o \
66
stb_image_write_impl.o stb_image_resize_impl.o optparse_impl.o pvr_texture.o \
7-
dither.o tddither.o vqcompress.o mycommon.o file_common.o \
8-
file_pvr.o file_tex.o file_dctex.o pvr_texture_encoder.o main.o
7+
dither.o tddither.o vqcompress.o mycommon.o palette.o file_common.o \
8+
file_pvr.o file_tex.o file_dctex.o pvr_texture_encoder.o pvr_texture_decoder.o main.o
99

10-
CPPFLAGS = -Ilibavutil -I. -DCONFIG_MEMORY_POISONING=0 -DHAVE_FAST_UNALIGNED=0
11-
CXXFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare
12-
13-
ifdef $(DEBUGBUILD)
14-
CXXFLAGS += -Og -pg -g
10+
ifeq ($(DEBUGBUILD), true)
11+
OPTMODE= -Og -pg -g
1512
else
16-
CXXFLAGS += -O3
13+
OPTMODE= -O3 -flto=auto -march=native
1714
endif
1815

19-
CFLAGS := $(CXXFLAGS) -Wno-pointer-sign -std=gnu17
16+
MYFLAGS=-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Ilibavutil -I. -DCONFIG_MEMORY_POISONING=0 -DHAVE_FAST_UNALIGNED=0
17+
MYCPPFLAGS=$(MYFLAGS)
18+
MYCFLAGS=$(MYFLAGS) -Wno-pointer-sign
2019

2120
define textSegment2Header
2221
mkdir -p info
@@ -25,15 +24,22 @@ define textSegment2Header
2524
rm $2/$3.txt
2625
endef
2726

28-
.PHONY: all clean
29-
3027
all: $(TARGET) README
3128

32-
$(TARGET): $(OBJS)
33-
$(CXX) $(CXXFLAGS) -o $@ $^
29+
.PHONY: all clean install
3430

3531
main.o: main.c info/options.h info/examples.h
3632

33+
%.o: %.c
34+
gcc $(CFLAGS) $(MYCFLAGS) $(OPTMODE) -c $< -o $@
35+
36+
%.o: %.cpp
37+
gcc $(CFLAGS) $(MYCPPFLAGS) $(CXXFLAGS) $(OPTMODE) -c $< -o $@
38+
39+
$(TARGET): $(OBJS)
40+
gcc $(OPTMODE) -o $(TARGET) \
41+
$(OBJS) $(PROGMAIN) -lm -lstdc++
42+
3743
clean:
3844
rm -f $(TARGET) $(OBJS) README
3945

@@ -43,8 +49,16 @@ README: readme_unformatted.txt
4349
install: all
4450
install -m 755 $(TARGET) $(DC_TOOLS_BASE)/
4551

52+
4653
info/options.h: README Makefile
4754
$(call textSegment2Header,Command Line Options:,info,options)
4855

4956
info/examples.h: README Makefile
5057
$(call textSegment2Header,Usage Examples:,info,examples)
58+
59+
bash-completion-dir:
60+
mkdir -p ~/.local/share/bash-completion/completions
61+
62+
63+
install-bash-completion: bash-completion-dir
64+
install pvrtex-completion.bash ~/.local/share/bash-completion/completions/pvrtex.bash

utils/pvrtex/avstring.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <stdio.h>
2626
#include <string.h>
2727

28+
#include "config.h"
2829
#include "mem.h"
2930
#include "avassert.h"
3031
#include "avstring.h"

utils/pvrtex/config.h

Whitespace-only changes.

utils/pvrtex/crc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21+
#include "config.h"
22+
2123
#include "thread.h"
2224
#include "avassert.h"
2325
#include "bswap.h"

0 commit comments

Comments
 (0)