Commit Graph

12 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
a6a52ecc73 [PowerVR] pvrtcDecompress(): Fix byte order isuses on BE.
- Use le32_to_cpu() for the source data.
- Rearrange Pixel32 on BE.

Added non-intrinsic macros using byteorder.h. Can't easily add
intrinsic macros without CMake detection. (Might do that later.)

ImageDecoderTest BE failures before: 15
ImageDecoderTest BE failures after:  11
2022-07-05 19:58:36 -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
c9c763662e PVRTDecompress.cpp: Reduce a static const array from int32_t to uint8_t; add an assert for rom-properties.
Code size difference: (64-bit Gentoo Linux, gcc-11.2.0, release build, no LTO)

   text    data     bss     dec     hex filename
   7774       0       0    7774    1e5e PVRTDecompress.cpp.o [before]
   7738       0       0    7738    1e3a PVRTDecompress.cpp.o [after]
    -36       0       0     -36     -24 Difference
2021-09-17 20:16:14 -04:00
David Korth
a1a2e0895c Set all projects to require CMake 3.0.
- Added language specifications.
- Set the top-level project version in the PROJECT() call.
- Set CMP0063 to NEW if it's available. This enables the symbol
  visibility presets on *all* target types, not just shared libraries,
  module libraries, and executables with ENABLE_EXPORTS set.
2020-06-19 18:02:04 -04:00
David Korth
3bc3cd1bee [PowerVR] PVRTDecompress: Handle PVRTC-II punch-through alpha changes.
PVRTC-II sets the RGB values of punch-through alpha pixels to 0.
PVRTC-I used the upscaled color values.
2019-12-15 03:17:44 -05:00
David Korth
42bf06e82c [PowerVR] PVRTDecompress.cpp: Initial support for PVRTC-II decoding.
Main changes:
- Color A and Color B now share an opaque flag.
- Color B: The low bit of alpha is always 1, not 0.
- Tiles are stored in linear order, not Morton order.

To make it easier to support both formats with minimal changes, the
original PVRTC code has been changed to use templated functions.
Simple non-templated wrapper functions are provided for external use.

PowerVR3, KhronosKTX: Handle PVRTC-II. Note that there's no FourCC
defined for DDS, so we're not updating DirectDrawSurface.

TODO:
- The Hard transition flag isn't supported. PVRTexToolCLI didn't use the
  hard transition flag when creating the test images.

[libromdata/tests] ImageDecoderTest: Added some PVRTC-II test images.
Based on tctest's example.png. Note that the PVRTC-II test images are
the full 512x512, whereas the PVRTC-I test image was 256x256.
2019-12-15 02:43:22 -05:00
David Korth
7086d0ed78 [PowerVR} PVRTDecompress: Swap the Red and Blue channels.
This matches rom-properties' ARGB32 format.

TODO: Verify on big-endian?
2019-12-10 22:01:22 -05:00
David Korth
c25945229e [PowerVR} PVRTDecompress: Removed ETC1 decompression.
We have our own ETC1 decompression code, which might be somewhat faster
than PowerVR's due to use of lookup tables. (Maybe I should benchmark
this later...)
2019-12-10 22:01:22 -05:00
David Korth
e51803a4fe [librptexture] Use the PowerVR Native SDK (well, a subset) to decode PVRTC.
It seems that the R and B channels are backwards, so we'll need to fix
that next. Other than that, both 2bpp and 4bpp decoding seems to work.
(A lot better than my terrible attempt, at least.)

[cmake] options.cmake: Added an option for PVRTC. The code is licensed
under the MIT license, but we might as well provide an option for it
because it's third-party code instead of my own code.

TODO:
- Fix R/B channel ordering.
- PVRTC-II decoding?
- Add PVRTC decoding to KTX and DDS.
2019-12-10 22:01:21 -05:00