Skip to content

Commit

Permalink
Update astc-encoder to 4.8.0 (subrepo pull). (#918)
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "external/astc-encoder"
  merged:   "8f02c368e"
upstream:
  origin:   "https://github.com/ARM-software/astc-encoder.git"
  branch:   "main"
  commit:   "c97319695"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/MarkCallow/git-subrepo.git"
  commit:   "c1f1132"

* Regenerate golden ASTC images.

* Force CMake cache values to show selected encoder ISA.
  • Loading branch information
MarkCallow authored Jun 14, 2024
1 parent 8cd4fea commit 7fb646c
Show file tree
Hide file tree
Showing 125 changed files with 9,511 additions and 3,655 deletions.
49 changes: 32 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1034,17 +1034,33 @@ endif()

add_subdirectory(interface/basisu_c_binding)

# Only one architecture is supported at once, if neither ASTCENC_ISA_SSE41
# nor ASTCENC_ISA_SSE2 are defined, ASTCENC_ISA_AVX2 is chosen. If
# ASTCENC_ISA_AVX2 fails to compile user must chose other x86 options.
# On arm based systems ASTCENC_ISA_NEON is the default. If we detect
# the user is doing a universal build then SIMD is disabled.

list(FIND CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" ASTCENC_BUILD_UNIVERSAL)
list(LENGTH CMAKE_OSX_ARCHITECTURES ARCHITECTURE_COUNT)
# On Linux and Windows only one architecture is supported at once. If neither
# ASTCENC_ISA_SSE41 nor ASTCENC_ISA_SSE2 are defined, ASTCENC_ISA_AVX2 is
# chosen. If ASTCENC_ISA_AVX2 fails to compile user must chose other x86
# options. On arm based systems ASTCENC_ISA_NEON is the default. On macOS,
# if we detect the user is doing a universal build defer to astc-encoder
# to pick the architectures.
#
# To ensure BASISU_SUPPORT_SSE is disabled when building for multiple
# architectures use only the value of CMAKE_OSX_ARCHITECTURES to decide if
# a universal build is requested. Do not expose the astc-encoder's
# ASTCENC_UNIVERSAL_BUILD configuration option.

set(universal_build OFF)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
# Check CMAKE_OSX_ARCHITECTURES for multiple architectures.
list(FIND CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" archs_standard)
list(LENGTH CMAKE_OSX_ARCHITECTURES architecture_count)
if(NOT ${archs_standard} EQUAL -1 OR architecture_count GREATER 1)
set(universal_build ON)
endif()
# Set ordinary variable to override astc-encoder option's ON default
# and hide the option.
set(ASTCENC_UNIVERSAL_BUILD ${universal_build})
endif()

if(${ASTCENC_BUILD_UNIVERSAL} EQUAL -1 AND ARCHITECTURE_COUNT LESS_EQUAL 1)
if (${ASTCENC_ISA_NONE})
if(NOT ${universal_build})
if(${ASTCENC_ISA_NONE})
set(ASTCENC_LIB_TARGET astcenc-none-static)
else()
if(CPU_ARCHITECTURE STREQUAL x86_64 OR CPU_ARCHITECTURE STREQUAL x86)
Expand All @@ -1053,26 +1069,25 @@ if(${ASTCENC_BUILD_UNIVERSAL} EQUAL -1 AND ARCHITECTURE_COUNT LESS_EQUAL 1)
elseif (${ASTCENC_ISA_SSE2})
set(ASTCENC_LIB_TARGET astcenc-sse2-static)
else()
set(ASTCENC_ISA_AVX2 ON)
# The existing documentation string continues to be used...
set(ASTCENC_ISA_AVX2 ON CACHE BOOL "" FORCE)
set(ASTCENC_LIB_TARGET astcenc-avx2-static)
endif()
if(CPU_ARCHITECTURE STREQUAL x86)
set(ASTCENC_ISA_NONE ON)
set(ASTCENC_ISA_AVX2 OFF)
set(ASTCENC_ISA_NONE ON CACHE BOOL "" FORCE)
set(ASTCENC_ISA_AVX2 OFF CACHE BOOL "" FORCE)
set(ASTCENC_POPCNT 0)
set(ASTCENC_LIB_TARGET astcenc-none-static)
endif()
elseif(CPU_ARCHITECTURE STREQUAL armv8 OR CPU_ARCHITECTURE STREQUAL arm64)
set(ASTCENC_ISA_NEON ON CACHE BOOL "" FORCE)
set(ASTCENC_LIB_TARGET astcenc-neon-static)
set(ASTCENC_ISA_NEON ON)
else()
message(STATUS "Unsupported ISA for ASTC on ${CPU_ARCHITECTURE} arch, using ASTCENC_ISA_NONE.")
set(ASTCENC_ISA_NONE ON CACHE BOOL "" FORCE)
set(ASTCENC_LIB_TARGET astcenc-none-static)
set(ASTCENC_ISA_NONE ON)
endif()
endif()
else()
set(ASTCENC_LIB_TARGET astcenc-static)
endif()

# astcenc
Expand Down
231 changes: 231 additions & 0 deletions external/astc-encoder/.github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
name: build-test
run-name: Build and test

on:
workflow_dispatch:
pull_request:
branches:
- main

jobs:
build-ubuntu:
name: Build and test on Ubuntu
runs-on: ubuntu-22.04
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Build R
run: |
export CXX=clang++
mkdir build_rel
cd build_rel
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_ISA_NONE=ON -DASTCENC_UNITTEST=ON -DASTCENC_PACKAGE=x64 ..
make install package -j4
- name: Build D
run: |
export CXX=clang++
mkdir build_dbg
cd build_dbg
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_ISA_NONE=ON ..
make -j4
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: astcenc-linux-x64
path: |
build_rel/*.zip
build_rel/*.zip.sha256
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Get Python modules
run: |
python -m pip install --upgrade pip
pip install numpy Pillow
- name: Python Tests
run: |
python ./Test/astc_test_functional.py --encoder=none
python ./Test/astc_test_functional.py --encoder=sse2
python ./Test/astc_test_functional.py --encoder=sse4.1
python ./Test/astc_test_functional.py --encoder=avx2
python ./Test/astc_test_image.py --encoder=none --test-set Small --test-quality medium
python ./Test/astc_test_image.py --encoder=all-x86 --test-set Small --test-quality medium
- name: ctest
run: ctest
working-directory: build_rel

build-macos:
name: Build and test on MacOS
runs-on: macos-12
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Build R
run: |
mkdir build_rel
cd build_rel
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_UNIVERSAL_BUILD=OFF -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_PACKAGE=x64 ..
make install package -j4
- name: Build D
run: |
mkdir build_dbg
cd build_dbg
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DASTCENC_UNIVERSAL_BUILD=OFF -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_ISA_NONE=ON ..
make -j4
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: astcenc-macos-x64
path: |
build_rel/*.zip
build_rel/*.zip.sha256
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Get Python modules
run: |
python -m pip install --upgrade pip
pip install numpy Pillow
- name: Python Tests
run: |
python ./Test/astc_test_image.py --test-set Small --test-quality medium
build-windows-msvc:
name: Build and test on Windows MSVC
runs-on: windows-2022
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Setup Visual Studio x86_6
uses: ilammy/msvc-dev-cmd@v1
- name: Build R
run: |
mkdir build_rel
cd build_rel
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_PACKAGE=x64-cl ..
nmake install package
shell: cmd
- name: Build D
run: |
mkdir build_dbg
cd build_dbg
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_ISA_NONE=ON ..
nmake
shell: cmd

- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: astcenc-windows-x64-cl
path: build_rel/*.zip

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Get Python modules
run: |
python -m pip install --upgrade pip
pip install numpy Pillow
shell: cmd

- name: Python Tests
run: |
python ./Test/astc_test_image.py --test-set Small --test-quality medium
shell: cmd

build-windows-ClangCL:
name: Build and test on Windows ClangCL
runs-on: windows-2022
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Setup Visual Studio x86_6
uses: ilammy/msvc-dev-cmd@v1
- name: Build R
run: |
mkdir build_rel
cd build_rel
cmake -G "Visual Studio 17 2022" -T ClangCL -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_PACKAGE=x64-clangcl ..
msbuild astcencoder.sln -property:Configuration=Release
msbuild PACKAGE.vcxproj -property:Configuration=Release
msbuild INSTALL.vcxproj -property:Configuration=Release
shell: cmd
- name: Build D
run: |
mkdir build_dbg
cd build_dbg
cmake -G "Visual Studio 17 2022" -T ClangCL -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON ..
msbuild astcencoder.sln -property:Configuration=Debug
shell: cmd

- name: Setup Visual Studio arm64
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_arm64
- name: Build R
run: |
mkdir build_rel_arm64
cd build_rel_arm64
cmake -G "Visual Studio 17 2022" -A ARM64 -T ClangCL -DASTCENC_ISA_NEON=ON -DASTCENC_PACKAGE=arm64-clangcl ..
msbuild astcencoder.sln -property:Configuration=Release
msbuild PACKAGE.vcxproj -property:Configuration=Release
msbuild INSTALL.vcxproj -property:Configuration=Release
shell: cmd
- name: Build D
run: |
mkdir build_dbg_arm64
cd build_dbg_arm64
cmake -G "Visual Studio 17 2022" -A ARM64 -T ClangCL -DASTCENC_ISA_NEON=ON ..
msbuild astcencoder.sln -property:Configuration=Debug
shell: cmd

- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: astcenc-windows-multi-clangcl
path: |
build_rel/*.zip
build_rel_arm64/*.zip
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Get Python modules
run: |
python -m pip install --upgrade pip
pip install numpy Pillow
shell: cmd

- name: Python Tests
run: |
python ./Test/astc_test_image.py --test-set Small --test-quality medium
shell: cmd
Loading

0 comments on commit 7fb646c

Please sign in to comment.