Commit Graph

14 Commits

Author SHA1 Message Date
David Korth
f0647da5eb Remove CheckHiddenVisibility.cmake.
The root CMakeLists.txt has a minimum CMake version of 3.5, and
CheckHiddenVisibility.cmake's workarounds are only needed for
CMake 3.2 and earlier.

Set CMP0063 unconditionally (added in CMake 3.3) and set the
CMAKE_<LANG>_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN
variables where CHECK_HIDDEN_VISIBILITY() was called before.

There should effectively be no code changes with this commit.
2025-01-18 22:34:24 -05:00
David Korth
d470035e61 Switch to CMake's POSITION_INDEPENDENT_CODE property instead of manually adding "-fpic -fPIC".
Something changed that caused the build on Xubuntu 16.04 (32-bit) to fail:

[ 63%] Linking CXX shared library ../../lib/libromdata.so
/usr/bin/ld: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
src/libromdata/CMakeFiles/romdata.dir/build.make:3614: recipe for target 'lib/libromdata.so.6.0' failed
make[2]: *** [lib/libromdata.so.6.0] Error 1

Setting POSITION_INDEPENDENT_CODE instead of "-fpic -fPIC" fixes this.

[extlib] Correctly set properties on the 'mspack' target instead of
'libmspack'. Otherwise, libmspack won't have either EXCLUDE_FROM_ALL
or POSITION_INDEPENDENT_CODE.
2025-01-05 14:02:13 -05:00
David Korth
4c64309bc5 Split librpcpu into librpbyteswap and librpcpuid.
librpbyteswap is still embedded into libromdata and has exported
functions.

librpcpuid is a standalone static library and will be linked into
anything that needs CPU flags, instead of using __builtin_cpu_supports().
librpcpuid's version is more efficient because it has fewer tests and
it doesn't do string comparisons.

Remove #include "byteorder.h" from a few files, since it isn't actually used:
- librpbase/img/RpPng.cpp
- librpbase/img/RpPngWriter.cpp
- libromdata/disc/xdvdfs_structs.h
- libromdata/Media/hsfs_structs.h

[gtk,librpbase] Remove #include "librpcpu/cpu_dispatch.h" from stdafx.h,
since it's only used by a few files.

[gtk3] CMakeLists.txt: Removed SSSE3 checks. SSSE3 is only used by
GdkImageConv, which is only used by the XFCE (GTK2) UI frontend.

[gtk3] CairoImageConv.hpp: Remove #include "librpcpu/cpu_dispatch.h",
since it isn't actually used here.

[xfce] GdkImageConv_ifunc.cpp, [librpbyteswap] byteswap_ifunc.c:
- #include "config.librpcpuid.h" before checking for HAVE_IFUNC.
  This was indirectly included before, but explicitly including it
  allows us to skip the other inclusion if IFUNC is not available.
2024-03-14 21:56:58 -04:00
David Korth
699fa25ab3 [basisu_astc] Fix the output stage for Big-Endian.
This fixes the last failing test in ImageDecoderTest:

TCtest_ASTC/ImageDecoderTest.decodeTest/tctest_example_astc_dds_gz_Image,
	where GetParam() = tctest/example-astc.dds.gz
2022-09-10 15:46:59 -04:00
David Korth
c67e06b6b2 Disable symbol visibility in several extlib modules using static linking.
PowerVR, basisu_astc, inih, libmspack-xenia, and unice68 were leaking
externally-visible symbols in the Linux builds of UI frontends.
2022-06-18 15:29:52 -04:00
David Korth
1725543f79 [basisu_astc] Some micro-optimizations with loops.
Test image: ast_o_ty1_mecha02_R.tga-d8b5c072d0be593e4a0cd7abc38e96ff.astc.stex
(1024x1024, ASTC_8x8)

Valgrind event count:
- Before: 675,564,532
- After:  667,186,111
- Diff:    -8,378,421 (-1.25%)

Code size difference: (64-bit Gentoo Linux, gcc-11.2.0, release build, no LTO)

   text    data     bss     dec     hex filename
  16603       0       0   16603    40db basisu_astc_decomp.cpp.o [before]
  16507       0       0   16507    4073 basisu_astc_decomp.cpp.o [after]
    -96       0       0     -96     -60 Difference
2021-09-09 19:14:11 -04:00
David Korth
cf6c8709df [basisu_astc] decompress(): Flatten the two loops into one; use pointer arithmetic.
Code size differences: (64-bit Gentoo Linux, gcc-11.2.0, release build, no LTO)

   text    data     bss     dec     hex filename
  16752       0       0   16752    4170 basisu_astc_decomp.cpp.o [before]
  16603       0       0   16603    40db basisu_astc_decomp.cpp.o [after]
   -149       0       0    -149     -95 Difference
2021-09-07 01:05:31 -04:00
David Korth
14e6457753 [basisu_astc] Converted another ternary comparison tree to switch/case.
Code size differences: (64-bit Gentoo Linux, gcc-11.2.0, release build, no LTO)

   text    data     bss     dec     hex filename
  16752       0       0   16752    4170 basisu_astc_decomp.cpp.o [before]
  16752       0       0   16752    4170 basisu_astc_decomp.cpp.o [after]
      0       0       0       0       0 Difference

No code size change, but it's definitely better code now...
2021-09-07 00:58:00 -04:00
David Korth
3f91824bc5 [basisu_astc] Converted some more 32-bit arrays to 8-bit arrays.
Code size differences: (64-bit Gentoo Linux, gcc-11.2.0, release build, no LTO)

   text    data     bss     dec     hex filename
  16877       0       0   16877    41ed basisu_astc_decomp.cpp.o [before]
  16752       0       0   16752    4170 basisu_astc_decomp.cpp.o [after]
   -125       0       0    -125     -7d Difference
2021-09-07 00:52:29 -04:00
David Korth
9fd6094561 [basisu_astc] Convert a large ternary comparison tree to switch/case.
This makes it easier to read and reduces code size a bit.

Code size differences: (64-bit Gentoo Linux, gcc-11.2.0, release build, no LTO)

   text    data     bss     dec     hex filename
  16889       0       0   16889    41f9 basisu_astc_decomp.cpp.o [before]
  16877       0       0   16877    41ed basisu_astc_decomp.cpp.o [after]
    -12       0       0     -12      -c Difference
2021-09-07 00:50:16 -04:00
David Korth
c0cca0d723 [basisu_astc] basisu_astc_decomp.cpp: Swap the R and B channels to match the expected data formats. 2021-09-03 23:35:50 -04:00
David Korth
35fd0d7a5b [basisu_astc] Add gcc fall-through comments.
Fix copy/paste error with the _MODIFIED_BASISU.txt filename,
and add new stuff to it.
2021-09-03 23:31:02 -04:00
David Korth
ec52d1b2f7 [basisu_astc] basisu_astc_decomp.cpp: Change some arrays from 32-bit to 8-bit.
These arrays don't have values that exceed 255, so there's no point
in wasting all the space.

Code size differences: (64-bit Gentoo Linux, gcc-11.2.0, release build, no LTO)

   text    data     bss     dec     hex filename
  23065       0       0   23065    5a19 basisu_astc_decomp.cpp.o [before]
  16889       0       0   16889    41f9 basisu_astc_decomp.cpp.o [after]
  -6176       0       0   -6176   -1820 Difference
2021-09-03 23:27:33 -04:00
David Korth
1317a931d4 [librptexture] GodotSTEX: Initial implementation of ASTC 8x8 decoding.
Added the ASTC decoder from Basis Universal.

FIXME: The decoded images have swapped R and B channels.
2021-09-03 23:24:42 -04:00