Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpng: Enable intrinsics on x86/SSE2, ppc64/VSX, and all arm/NEON #78325

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions drivers/png/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@ if env["builtin_libpng"]:
# Needed for drivers includes and in platform/web.
env.Prepend(CPPPATH=[thirdparty_dir])

# Currently .ASM filter_neon.S does not compile on NT.
import os

# Enable ARM NEON instructions on 32-bit Android to compile more optimized code.
use_neon = env["platform"] == "android" and env["arch"] == "arm32" and os.name != "nt"
if use_neon:
env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 2)])
else:
env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 0)])

env_thirdparty = env_png.Clone()
env_thirdparty.disable_warnings()
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)

if use_neon:
env_neon = env_thirdparty.Clone()
if "S_compiler" in env:
env_neon["CC"] = env["S_compiler"]
neon_sources = []
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/palette_neon_intrinsics.c"))
thirdparty_obj += neon_sources
if env["arch"].startswith("arm"):
if env.msvc: # Can't compile assembly files with MSVC.
env_thirdparty.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT"), 0])
else:
env_neon = env_thirdparty.Clone()
if "S_compiler" in env:
env_neon["CC"] = env["S_compiler"]
neon_sources = []
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/palette_neon_intrinsics.c"))
thirdparty_obj += neon_sources
elif env["arch"].startswith("x86"):
env_thirdparty.Append(CPPDEFINES=["PNG_INTEL_SSE"])
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "/intel/intel_init.c")
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "/intel/filter_sse2_intrinsics.c")
elif env["arch"] == "ppc64":
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "/powerpc/powerpc_init.c")
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_dir + "/powerpc/filter_vsx_intrinsics.c")

env.drivers_sources += thirdparty_obj

Expand Down
1 change: 0 additions & 1 deletion modules/text_server_adv/gdextension_build/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ if env["freetype_enabled"]:
CPPDEFINES=[
"FT2_BUILD_LIBRARY",
"FT_CONFIG_OPTION_USE_PNG",
("PNG_ARM_NEON_OPT", 0),
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
]
)
Expand Down
1 change: 0 additions & 1 deletion modules/text_server_fb/gdextension_build/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ if env["freetype_enabled"]:
CPPDEFINES=[
"FT2_BUILD_LIBRARY",
"FT_CONFIG_OPTION_USE_PNG",
("PNG_ARM_NEON_OPT", 0),
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
]
)
Expand Down
5 changes: 2 additions & 3 deletions platform/ios/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,18 @@ def configure(env: "Environment"):
env["ENV"]["PATH"] = env["IOS_TOOLCHAIN_PATH"] + "/Developer/usr/bin/:" + env["ENV"]["PATH"]

compiler_path = "$IOS_TOOLCHAIN_PATH/usr/bin/${ios_triple}"
s_compiler_path = "$IOS_TOOLCHAIN_PATH/Developer/usr/bin/"

ccache_path = os.environ.get("CCACHE")
if ccache_path is None:
env["CC"] = compiler_path + "clang"
env["CXX"] = compiler_path + "clang++"
env["S_compiler"] = s_compiler_path + "gcc"
env["S_compiler"] = compiler_path + "clang"
else:
# there aren't any ccache wrappers available for iOS,
# to enable caching we need to prepend the path to the ccache binary
env["CC"] = ccache_path + " " + compiler_path + "clang"
env["CXX"] = ccache_path + " " + compiler_path + "clang++"
env["S_compiler"] = ccache_path + " " + s_compiler_path + "gcc"
env["S_compiler"] = ccache_path + " " + compiler_path + "clang"
env["AR"] = compiler_path + "ar"
env["RANLIB"] = compiler_path + "ranlib"

Expand Down
4 changes: 2 additions & 2 deletions thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,14 @@ Files extracted from upstream source:
## libpng

- Upstream: http://libpng.org/pub/png/libpng.html
- Version: 1.6.38 (0a158f3506502dfa23edfc42790dfaed82efba17, 2022)
- Version: 1.6.39 (07b8803110da160b158ebfef872627da6c85cbdf, 2022)
akien-mga marked this conversation as resolved.
Show resolved Hide resolved
- License: libpng/zlib

Files extracted from upstream source:

- all .c and .h files of the main directory, except from
`example.c` and `pngtest.c`
- the arm/ folder
- `arm/`, `intel/` and `powerpc/` folders
- `scripts/pnglibconf.h.prebuilt` as `pnglibconf.h`
- `LICENSE`

Expand Down
Loading
Loading