Add Ubuntu 24.04 CI, Fix Embree 4 (#434)
* Add Ubuntu 24.04 to CI matrix. * Fix embree4 bitrot. * For Linux, only upload artifact from Ubuntu 22.04 for now Should fix this error reported on ubuntu-22.04's CI Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run * Use system TBB and Embree 4 on ubuntu-24.04 * skip packaging of embree/TBB if using system provided packages * For Linux, only upload artifact from Ubuntu 22.04 for now (fix) * common: fix ASan error on non-null-terminated (16 char long) texture names --------- Co-authored-by: Daniel Svensson <dsvensson@gmail.com>
This commit is contained in:
parent
5142116294
commit
8ac82b7c79
|
|
@ -13,6 +13,7 @@ jobs:
|
|||
matrix:
|
||||
os:
|
||||
- ubuntu-22.04
|
||||
- ubuntu-24.04
|
||||
- macos-12
|
||||
- windows-2022
|
||||
use-asan:
|
||||
|
|
@ -33,6 +34,11 @@ jobs:
|
|||
run: |
|
||||
sudo apt update
|
||||
sudo apt install qtbase5-dev libqt5svg5-dev
|
||||
- name: 'Linux: Install TBB and Embree, if using distro packages'
|
||||
if: ${{ matrix.os == 'ubuntu-24.04' }}
|
||||
run: |
|
||||
sudo apt install libtbb-dev libembree-dev
|
||||
echo "USE_SYSTEM_TBB_AND_EMBREE=1" >> $GITHUB_ENV
|
||||
- name: 'Linux: Build the artifact'
|
||||
if: startsWith(matrix.os, 'ubuntu-')
|
||||
run: ./build-linux-64.sh
|
||||
|
|
@ -42,7 +48,7 @@ jobs:
|
|||
mkdir ericw-tools-linux
|
||||
unzip build-linux/*-Linux.zip -d ericw-tools-linux
|
||||
- name: 'Linux: Upload the artifact'
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.use-asan == 'NO' }}
|
||||
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.use-asan == 'NO' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: ericw-tools-linux/
|
||||
|
|
@ -50,7 +56,7 @@ jobs:
|
|||
if-no-files-found: error
|
||||
- name: 'Linux: Create GitHub Release and upload build'
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.use-asan == 'NO' && startsWith(github.ref, 'refs/tags/') }}
|
||||
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.use-asan == 'NO' && startsWith(github.ref, 'refs/tags/') }}
|
||||
with:
|
||||
draft: true
|
||||
files: |
|
||||
|
|
|
|||
|
|
@ -14,20 +14,29 @@ cmake --version
|
|||
|
||||
mkdir "$BUILD_DIR"
|
||||
cd "$BUILD_DIR"
|
||||
wget -q https://github.com/embree/embree/releases/download/v3.13.1/embree-3.13.1.x86_64.linux.tar.gz -O embree.tgz
|
||||
wget -q https://github.com/oneapi-src/oneTBB/releases/download/v2021.3.0/oneapi-tbb-2021.3.0-lin.tgz -O tbb.tgz
|
||||
|
||||
tar xf embree.tgz
|
||||
tar xf tbb.tgz
|
||||
|
||||
EMBREE_CMAKE_DIR="$(pwd)/embree-3.13.1.x86_64.linux/lib/cmake/embree-3.13.1"
|
||||
TBB_CMAKE_DIR="$(pwd)/oneapi-tbb-2021.3.0/lib/cmake"
|
||||
|
||||
# check USE_ASAN environment variable (see cmake.yml)
|
||||
if [ "$USE_ASAN" == "YES" ]; then
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR" -DENABLE_LIGHTPREVIEW=YES -DERICWTOOLS_ASAN=YES
|
||||
if [ "$USE_SYSTEM_TBB_AND_EMBREE" == "1" ]; then
|
||||
if [ "$USE_ASAN" == "YES" ]; then
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DERICWTOOLS_ASAN=YES -DSKIP_EMBREE_INSTALL=YES -DSKIP_TBB_INSTALL=YES
|
||||
else
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DSKIP_EMBREE_INSTALL=YES -DSKIP_TBB_INSTALL=YES
|
||||
fi
|
||||
else
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR"
|
||||
wget -q https://github.com/embree/embree/releases/download/v3.13.1/embree-3.13.1.x86_64.linux.tar.gz -O embree.tgz
|
||||
wget -q https://github.com/oneapi-src/oneTBB/releases/download/v2021.3.0/oneapi-tbb-2021.3.0-lin.tgz -O tbb.tgz
|
||||
|
||||
tar xf embree.tgz
|
||||
tar xf tbb.tgz
|
||||
|
||||
EMBREE_CMAKE_DIR="$(pwd)/embree-3.13.1.x86_64.linux/lib/cmake/embree-3.13.1"
|
||||
TBB_CMAKE_DIR="$(pwd)/oneapi-tbb-2021.3.0/lib/cmake"
|
||||
|
||||
# check USE_ASAN environment variable (see cmake.yml)
|
||||
if [ "$USE_ASAN" == "YES" ]; then
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR" -DENABLE_LIGHTPREVIEW=YES -DERICWTOOLS_ASAN=YES
|
||||
else
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
# not yet free of memory leaks, so don't abort on leak detection
|
||||
|
|
|
|||
22
common/fs.cc
22
common/fs.cc
|
|
@ -159,8 +159,24 @@ struct wad_archive : archive_like
|
|||
uint8_t compression;
|
||||
padding<2> pad;
|
||||
std::array<char, 16> name; // must be null terminated
|
||||
// NOTE: textures using all 16 exist in the wild, e.g. openquartzmirror
|
||||
// in free_wad.wad
|
||||
|
||||
auto stream_data() { return std::tie(filepos, disksize, size, type, compression, pad, name); }
|
||||
|
||||
std::string name_as_string() const {
|
||||
size_t length = 0;
|
||||
|
||||
// count the number of leading non-null characters
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
if (name[i] != 0)
|
||||
++length;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return std::string(name.data(), length);
|
||||
}
|
||||
};
|
||||
|
||||
std::unordered_map<std::string, std::tuple<uint32_t, uint32_t>, case_insensitive_hash, case_insensitive_equal>
|
||||
|
|
@ -189,7 +205,11 @@ struct wad_archive : archive_like
|
|||
|
||||
wadstream >= file;
|
||||
|
||||
files[file.name.data()] = std::make_tuple(file.filepos, file.disksize);
|
||||
std::string tex_name = file.name_as_string();
|
||||
if (tex_name.size() == 16) {
|
||||
logging::print("WARNING: texture name {} ({}) is not null-terminated\n", tex_name, pathname);
|
||||
}
|
||||
files[tex_name] = std::make_tuple(file.filepos, file.disksize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -243,8 +243,8 @@ public:
|
|||
|
||||
#ifdef HAVE_EMBREE4
|
||||
RTCIntersectArguments embree4_args = ctx2.setup_intersection_arguments();
|
||||
for (int i = 0; i < _numrays; ++i)
|
||||
rtcIntersect1(scene, &_rays[i], &embree4_args);
|
||||
for (auto &ray : _rays)
|
||||
rtcIntersect1(scene, &ray.ray, &embree4_args);
|
||||
#else
|
||||
rtcIntersect1M(scene, &ctx2, &_rays.data()->ray, _rays.size(), sizeof(_rays[0]));
|
||||
#endif
|
||||
|
|
@ -310,8 +310,8 @@ public:
|
|||
ray_source_info ctx2(this, self, shadowmask);
|
||||
#ifdef HAVE_EMBREE4
|
||||
RTCOccludedArguments embree4_args = ctx2.setup_occluded_arguments();
|
||||
for (int i = 0; i < _numrays; ++i)
|
||||
rtcOccluded1(scene, &_rays[i], &embree4_args);
|
||||
for (auto &ray : _rays)
|
||||
rtcOccluded1(scene, &ray.ray.ray, &embree4_args);
|
||||
#else
|
||||
rtcOccluded1M(scene, &ctx2, &_rays.data()->ray.ray, _rays.size(), sizeof(_rays[0]));
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue