Bläddra i källkod

Upgrade astc-encoder to use SSE4 on all platforms (#68)

* Upgrade astc-encoder to use SSE4 on all platforms

Signed-off-by: lawsonamzn <[email protected]>
Nicholas Lawson 3 år sedan
förälder
incheckning
90480ca41d

+ 2 - 0
.gitignore

@@ -6,3 +6,5 @@ TestResults/**
 .pytest_cache
 packages/
 **/temp/**
+qt_compile_log.txt
+

+ 1 - 0
package-system/.gitignore

@@ -17,6 +17,7 @@ NvCloth-*
 OpenSSL-*
 PhysX-*
 poly2tri-*
+qt-*
 RapidJSON-*
 SPIRVCross-*
 tiff-*

+ 4 - 4
package-system/astc-encoder/Findastc-encoder.cmake.template

@@ -14,13 +14,13 @@ set($${LIB_NAME}_INCLUDE_DIR $${CMAKE_CURRENT_LIST_DIR}/$${LIB_NAME}/include)
 set($${LIB_NAME}_LIBRARY_DIR $${CMAKE_CURRENT_LIST_DIR}/$${LIB_NAME}/bin)
 
 if ($${PAL_PLATFORM_NAME} STREQUAL "Windows")	
-    set($${LIB_NAME}_LIBRARY_RELEASE $${$${LIB_NAME}_LIBRARY_DIR}/Release/astcenc-sse2-static.lib)
-    set($${LIB_NAME}_LIBRARY_DEBUG $${$${LIB_NAME}_LIBRARY_DIR}/Debug/astcenc-sse2-static.lib
+    set($${LIB_NAME}_LIBRARY_RELEASE $${$${LIB_NAME}_LIBRARY_DIR}/Release/astcenc-sse4.1-static.lib)
+    set($${LIB_NAME}_LIBRARY_DEBUG $${$${LIB_NAME}_LIBRARY_DIR}/Debug/astcenc-sse4.1-static.lib)
 elseif ($${PAL_PLATFORM_NAME} STREQUAL "Linux")
-    set($${LIB_NAME}_LIBRARY_RELEASE $${$${LIB_NAME}_LIBRARY_DIR}/libastcenc-sse2-static.a)
+    set($${LIB_NAME}_LIBRARY_RELEASE $${$${LIB_NAME}_LIBRARY_DIR}/libastcenc-sse4.1-static.a)
     set($${LIB_NAME}_LIBRARY_DEBUG $${$${LIB_NAME}_LIBRARY_RELEASE})
 else()
-    set($${LIB_NAME}_LIBRARY_RELEASE $${$${LIB_NAME}_LIBRARY_DIR}/libastcenc-native-static.a)
+    set($${LIB_NAME}_LIBRARY_RELEASE $${$${LIB_NAME}_LIBRARY_DIR}/libastcenc-sse4.1-static.a)
     set($${LIB_NAME}_LIBRARY_DEBUG $${$${LIB_NAME}_LIBRARY_RELEASE})
 endif()
 

+ 1 - 1
package-system/astc-encoder/build_config.json

@@ -2,7 +2,7 @@
     "git_url": "https://github.com/ARM-software/astc-encoder.git",
     "git_tag": "3.2",
     "package_name": "astc-encoder",
-    "package_version": "3.2-rev1",
+    "package_version": "3.2-rev2",
     "package_url": "https://github.com/ARM-software/astc-encoder",
     "package_license": "Apache-2.0",
     "package_license_file": "LICENSE.txt",

+ 3 - 12
package-system/astc-encoder/build_linux.sh

@@ -5,15 +5,6 @@
 #
 # SPDX-License-Identifier: Apache-2.0 OR MIT
 
-cmake -S temp/src -B temp/build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DISA_SSE2=ON
-
-if [ $? -ne 0 ]; then
-    echo "Error generating build"
-    exit 1
-fi
-
-cmake --build temp/build -j 8
-if [ $? -ne 0 ]; then
-    echo "Error building"
-    exit 1
-fi
+# Note: on x86/x64 platforms, O3DE requires a minimum of SSE 4.1, so we do request this.
+cmake -S temp/src -B temp/build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DISA_SSE41=ON || exit $?
+cmake --build temp/build -j 8 || exit $?

+ 6 - 13
package-system/astc-encoder/build_mac.sh

@@ -9,19 +9,12 @@ export CXX=clang++
 
 # using -DISA_AVX2=ON enables build for x86_64
 # using -DISA_NEON=ON enables build for arm64 
-# to build arm64 requires xcode 12.3 and macos 11 which is not supported on my Mac
-# we have to disable cpu specific options for an universal build
+# to build arm64 requires xcode 12.3 and macos 11
+# Note: on x86/x64 platforms, O3DE requires a minimum of SSE 4.1, so we do request this.
 
-cmake -S temp/src -B temp/build -G "Unix Makefiles" 
+cmake -S temp/src -B temp/build -G "Unix Makefiles" \
+    -DISA_SSE41=ON \
+    -DCMAKE_TOOLCHAIN_FILE=../../../../Scripts/cmake/Platform/Mac/Toolchain_mac.cmake || exit $?
 
-if [ $? -ne 0 ]; then
-    echo "Error generating build"
-    exit 1
-fi
-
-cmake --build temp/build --config Release -j 8
-if [ $? -ne 0 ]; then
-    echo "Error building"
-    exit 1
-fi
+cmake --build temp/build --config Release --parallel || exit $?
 

+ 3 - 1
package-system/astc-encoder/build_windows.cmd

@@ -6,7 +6,9 @@ REM SPDX-License-Identifier: Apache-2.0 OR MIT
 REM
 REM
 
-cmake -S temp/src -B temp/build -G "Visual Studio 16 2019" -DISA_SSE2=ON
+REM Note: on x86/x64 platforms, O3DE requires a minimum of SSE 4.1, so we do request this.
+
+cmake -S temp/src -B temp/build -G "Visual Studio 16 2019" -DISA_SSE41=ON
 
 @if %errorlevel% NEQ 0 ( exit /b 1 )
 cmake --build temp/build --config Release -j 8

+ 2 - 2
package-system/astc-encoder/install_linux.sh

@@ -18,7 +18,7 @@ cp -f temp/src/Source/astcenc.h $INCLUDE_PATH/ || exit $?
 BUILD_PATH=temp/build/Source
 
 # copy static lib and executable
-cp -f $BUILD_PATH/astcenc-sse2 $BIN_PATH/ || exit $?
-cp -f $BUILD_PATH/libastcenc-sse2-static.a $BIN_PATH/ || exit $?
+cp -f $BUILD_PATH/astcenc-sse4.1 $BIN_PATH/ || exit $?
+cp -f $BUILD_PATH/libastcenc-sse4.1-static.a $BIN_PATH/ || exit $?
 
 exit 0

+ 3 - 3
package-system/astc-encoder/install_mac.sh

@@ -17,8 +17,8 @@ cp -f temp/src/Source/astcenc.h $INCLUDE_PATH/ || exit $?
 
 BUILD_PATH=temp/build/Source
 
-# copy static lib and executable
-cp -f $BUILD_PATH/astcenc-native $BIN_PATH/ || exit $?
-cp -f $BUILD_PATH/libastcenc-native-static.a $BIN_PATH/ || exit $?
+# copy sse4.1 lib and executable
+cp -f $BUILD_PATH/astcenc-sse4.1 $BIN_PATH/ || exit $?
+cp -f $BUILD_PATH/libastcenc-sse4.1-static.a $BIN_PATH/ || exit $?
 
 exit 0

+ 2 - 2
package_build_list_host_darwin.json

@@ -32,7 +32,7 @@
         "v-hacd-2.3-1a49edf-rev1-mac": "package-system/v-hacd/build_package_image.py --platform-name mac",
         "SPIRVCross-2021.04.29-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Mac --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Mac --package-root ../../package-system --clean",
-        "astc-encoder-3.2-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Mac --package-root ../../package-system --clean",
+        "astc-encoder-3.2-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Mac --package-root ../../package-system --clean",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Mac --package-root ../../package-system --clean",
         "azslc-1.7.34-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Mac --package-root ../../package-system --clean",
         "python-3.7.10-rev1-darwin": "package-system/python/build_package_image.py",
@@ -83,7 +83,7 @@
         "mcpp-2.7.2_az.2-rev1-mac": "package-system/mcpp-mac",
         "SPIRVCross-2021.04.29-rev1-mac": "package-system/SPIRVCross-mac",
         "squish-ccr-deb557d-rev1-mac": "package-system/squish-ccr-mac",
-        "astc-encoder-3.2-rev1-mac": "package-system/astc-encoder-mac",
+        "astc-encoder-3.2-rev2-mac": "package-system/astc-encoder-mac",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-mac": "package-system/DirectXShaderCompilerDxc-mac",
         "azslc-1.7.34-rev1-mac": "package-system/azslc-mac",
         "SQLite-3.32.2-rev3-multiplatform": "package-system/SQLite-multiplatform",

+ 2 - 2
package_build_list_host_linux.json

@@ -23,7 +23,7 @@
         "v-hacd-2.3-1a49edf-rev1-linux": "package-system/v-hacd/build_package_image.py --platform-name linux",
         "SPIRVCross-2021.04.29-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Linux --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux --package-root ../../package-system --clean",
-        "astc-encoder-3.2-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Linux --package-root ../../package-system --clean",
+        "astc-encoder-3.2-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Linux --package-root ../../package-system --clean",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux --package-root ../../package-system --clean",
         "azslc-1.7.34-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Linux --package-root ../../package-system --clean",
         "tiff-4.2.0.15-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/tiff --platform-name Linux --package-root ../../package-system --clean",
@@ -50,7 +50,7 @@
         "ilmbase-2.3.0-rev4-linux": "package-system/ilmbase-linux",
         "SPIRVCross-2021.04.29-rev1-linux": "package-system/SPIRVCross-linux",
         "squish-ccr-deb557d-rev1-linux": "package-system/squish-ccr-linux",
-        "astc-encoder-3.2-rev1-linux": "package-system/astc-encoder-linux",
+        "astc-encoder-3.2-rev2-linux": "package-system/astc-encoder-linux",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-linux": "package-system/DirectXShaderCompilerDxc-linux",
         "azslc-1.7.34-rev1-linux": "package-system/azslc-linux",
         "tiff-4.2.0.15-rev3-linux": "package-system/tiff-linux",

+ 2 - 1
package_build_list_host_windows.json

@@ -30,7 +30,7 @@
         "ilmbase-2.3.0-rev4-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenEXR --platform-name Windows --package-root ../../package-system --clean",
         "SPIRVCross-2021.04.29-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Windows --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Windows --package-root ../../package-system --clean",
-        "astc-encoder-3.2-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Windows --package-root ../../package-system --clean",
+        "astc-encoder-3.2-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Windows --package-root ../../package-system --clean",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Windows --package-root ../../package-system --clean",
         "azslc-1.7.34-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Windows --package-root ../../package-system --clean",
         "PhysX-4.1.2.29882248-rev4-windows": "package-system/PhysX/build_package_image.py --platform windows",
@@ -48,6 +48,7 @@
         "zlib-1.2.11-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Android --package-root ../../package-system --clean"
       },
   "build_from_folder": {
+    "astc-encoder-3.2-rev2-windows" : "package-system/astc-encoder-windows",
     "AWSGameLiftServerSDK-3.4.1-rev1-windows" : "package-system/AWSGameLiftServerSDK/windows",
     "AWSNativeSDK-1.7.167-rev3-windows": "package-system/AWSNativeSDK-windows",
     "AWSNativeSDK-1.7.167-rev6-android": "package-system/AWSNativeSDK-android",