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

astc-encoder: init at 2.5 #119018

Merged
merged 2 commits into from Apr 20, 2021
Merged

Conversation

dasisdormax
Copy link
Contributor

This builds the astc-encoder for the x86_64 architecture and sets
an astcenc symlink for the most compatible sse2 version.

Motivation for this change

I use the ASTC format for texture compression in a mobile game I develop with LibGDX, as it can encode alpha values and is supported by hardware on modern iOS and Android devices. This is a command line utility for converting regular images (optionally created by a texture packer) into the ASTC or KTX format.

Usage example:

  • Encoding: astcenc -cl input.png compressed.astc 6x6 -medium
  • Decoding: astcenc -dl compressed.astc decompressed.png

Original source on Github: https://github.com/ARM-software/astc-encoder

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

maintainers/maintainer-list.nix Show resolved Hide resolved
pkgs/tools/graphics/astc-encoder/default.nix Outdated Show resolved Hide resolved
pkgs/tools/graphics/astc-encoder/default.nix Show resolved Hide resolved
pkgs/tools/graphics/astc-encoder/default.nix Outdated Show resolved Hide resolved
pkgs/tools/graphics/astc-encoder/default.nix Outdated Show resolved Hide resolved
pkgs/tools/graphics/astc-encoder/default.nix Outdated Show resolved Hide resolved
pkgs/tools/graphics/astc-encoder/default.nix Outdated Show resolved Hide resolved
pkgs/tools/graphics/astc-encoder/default.nix Outdated Show resolved Hide resolved
@dasisdormax
Copy link
Contributor Author

@SuperSandro2000 Thanks for your suggestions. I added the compile settings for ARM and other platforms.

I tested the changes by cross-compiling with nix-build --arg crossSystem '(import <nixpkgs/lib>).systems.examples.aarch64-multiplatform' -A astc-encoder. This worked, but I cannot test if the binary works as intended.

@dasisdormax dasisdormax force-pushed the add-astc-encoder branch 2 times, most recently from afef13d to 29e3afe Compare April 16, 2021 19:31
Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with this change

pkgs/tools/graphics/astc-encoder/default.nix Outdated Show resolved Hide resolved
@risicle
Copy link
Contributor

risicle commented Apr 18, 2021

Fails to build for me, macos 10.14.

builder for '/nix/store/6a88aqmhd2gr1c4j2nqk9j85n991cb37-astc-encoder-2.5.drv' failed with exit code 2; last 10 log lines:
  [ 61%] Building CXX object Source/CMakeFiles/astcenc-sse2-static.dir/astcenc_platform_isa_detection.cpp.o
  [ 64%] Building CXX object Source/CMakeFiles/astcenc-sse2-static.dir/astcenc_quantization.cpp.o
  [ 67%] Building CXX object Source/CMakeFiles/astcenc-sse2-static.dir/astcenc_symbolic_physical.cpp.o
  [ 70%] Building CXX object Source/CMakeFiles/astcenc-sse2-static.dir/astcenc_weight_align.cpp.o
  [ 73%] Building CXX object Source/CMakeFiles/astcenc-sse2-static.dir/astcenc_weight_quant_xfer_tables.cpp.o
  [ 76%] Linking CXX static library libastcenc-sse2-static.a
  Error running link command: No such file or directory
  make[2]: *** [Source/CMakeFiles/astcenc-sse2-static.dir/build.make:464: Source/libastcenc-sse2-static.a] Error 2
  make[1]: *** [CMakeFiles/Makefile2:115: Source/CMakeFiles/astcenc-sse2-static.dir/all] Error 2
  make: *** [Makefile:171: all] Error 2

edit: I think it's trying to find ranlib.

@dasisdormax
Copy link
Contributor Author

Thanks for noticing the build error on Mac. After installing nix and trying the build myself, I got the same problem.

I'm not sure if this is easy to fix. If not, I'll mark the package as linux-only in the meantime.

This builds the astc-encoder with the appropriate SIMD
instructions automatically selected depending on host machine.
@dasisdormax
Copy link
Contributor Author

@risicle I got the macOS build fixed by switching from stdenv to gccStdenv

@risicle
Copy link
Contributor

risicle commented Apr 20, 2021

Ah well done - I'm sure it's possible to get it working using clang but it's a bit beyond my darwin-fu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants