Skip to content
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
19 changes: 19 additions & 0 deletions .github/actions/setup-linux/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Setup Linux build environment
description: Install dependencies
runs:
using: "composite"
steps:
- shell: bash
run: |
set -euo pipefail
sudo apt-get update -y -qq
sudo apt-get install libgl-dev \
libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-regex-dev libboost-timer-dev libsimde-dev \
libassimp-dev libopenal-dev libdevil-dev libfreetype-dev libbullet-dev \
libglew-dev libglu1-mesa-dev libgl1-mesa-dev \
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \
libpng-dev libalut-dev \
qtbase5-dev libgtest-dev \
doxygen graphviz \
nlohmann-json3-dev
103 changes: 55 additions & 48 deletions .github/workflows/main.yml → .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

name: CI
name: CI Linux
on:
push:
branches: [ dev ]
Expand All @@ -8,44 +7,32 @@ on:
release:
types: [published]
jobs:
build:
##############################
build-linux:
runs-on: ubuntu-24.04
steps:
# Note: some steps require the checkout in the root directory
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-linux
- name: Build REGEN workspace
shell: bash
run: |
sudo apt-get update -y -qq
sudo apt-get install libgl-dev \
libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-regex-dev libboost-timer-dev \
libassimp-dev libopenal-dev libdevil-dev libfreetype-dev libbullet-dev \
libglew-dev libglu1-mesa-dev libgl1-mesa-dev \
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \
libpng-dev libalut-dev \
qtbase5-dev libgtest-dev \
doxygen graphviz \
nlohmann-json3-dev
set -euo pipefail
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DBUILD_VIDEO_PLAYER=ON
make 2> >(tee "make-output.txt")
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_UNIT_TESTS=ON \
-DBUILD_TESTS=ON \
-DBUILD_VIDEO_PLAYER=ON
make -j$(nproc) 2> >(tee "make-output.txt")
- name: Annotate compilation warnings/errors
if: ${{github.event_name == 'pull_request'}}
uses: JacobDomagala/CompileResult@master
# just so that in case this step fails, the workflow doesn't stop.
# this is done as it is unclear how well the action is maintained.
continue-on-error: true
with:
comment_title: Compilation
compile_result_file: build/make-output.txt
- name: Create debian package
if: ${{github.event_name == 'push' || github.event_name == 'release'}}
shell: bash
run: |
cd build
cpack
- name: Run unit tests
if: ${{github.event_name == 'push' || github.event_name == 'pull_request'}}
shell: bash
Expand All @@ -59,12 +46,55 @@ jobs:
junit_files: "gtest-regen.xml"
action_fail: true
action_fail_on_inconclusive: true
#####
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test results
path: ./gtest-regen.xml
##############################
debian-package:
needs: build-linux
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-linux
- name: Create debian package
if: ${{github.event_name == 'push' || github.event_name == 'release'}}
shell: bash
run: |
set -euo pipefail
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release
cpack
- name: Release debian package
if: github.event_name == 'release'
shell: bash
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
run: |
gh release upload ${{github.event.release.tag_name}} ./build/regen-*.deb
- name: Upload debian package
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: debian package
path: ./build/regen-*.deb
##############################
doxygen:
needs: build-linux
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-linux
- name: Run doxygen
if: ${{github.event_name == 'push' || github.event_name == 'release'}}
shell: bash
run: |
set -euo pipefail
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release
cmake --build . --target doc
cp -r ../img regen/doc/html/
- name: Extract version tag
Expand All @@ -88,26 +118,3 @@ jobs:
BRANCH: gh-pages
# The folder the action should deploy.
FOLDER: build/regen/doc/html
# The folder in the target branch
TARGET_FOLDER: ${{ env.REGEN_DOCU_VERSION }}
CLEAN: true
SINGLE_COMMIT: true
#####
- name: Release debian package
if: github.event_name == 'release'
shell: bash
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
run: |
gh release upload ${{github.event.release.tag_name}} ./build/regen-*.deb
- name: Upload debian package
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: debian package
path: ./build/regen-*.deb
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test results
path: ./gtest-regen.xml
29 changes: 29 additions & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI MacOS
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
release:
types: [published]

jobs:
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
brew install cmake gcc simde boost assimp openal-soft freetype bullet glew qt5 doxygen graphviz devil ffmpeg alut nlohmann-json googletest
- name: Build REGEN workspace
run: |
mkdir build
cd build
cmake \
-DCMAKE_C_COMPILER=/opt/homebrew/bin/gcc-14 -DCMAKE_CXX_COMPILER=/opt/homebrew/bin/g++-14 \
-DCMAKE_PREFIX_PATH="/opt/homebrew/opt/qt@5" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=ON \
-DREGEN_EXTRA_INCLUDE_DIRS="/opt/homebrew/opt/openal-soft/include/" \
../
make
50 changes: 32 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ endif()
# given in the books "Effective C++" and "More Effective C++"
# add_definitions( -Weffc++ )

if(UNIX) # gcc options
add_definitions( -mfpmath=sse -march=native )
if(UNIX)
# -march=native enables all instruction subsets supported by the local machine
# e.g. SSE2, SSE3, SSE4, AVX, AVX2, etc.
add_definitions( -march=native )
endif()

# perform more aggressive floating-point optimizations
Expand Down Expand Up @@ -107,6 +109,10 @@ find_package(Boost ${Boost_MIN_VERSION}
find_package(Threads REQUIRED)
# Font library: text rendering support
find_package(Freetype REQUIRED)
# Note: On Linux, it seems needed in addition to link against brotlidec
if (UNIX AND NOT APPLE)
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} -lbrotlidec)
endif()
# JSON library: for serialization
find_package(nlohmann_json REQUIRED)
set(JSON_LIBRARIES nlohmann_json::nlohmann_json)
Expand Down Expand Up @@ -184,8 +190,10 @@ message(STATUS " Models:${ASSIMP_INCLUDE_DIRS};")
message(STATUS " Fonts:${FREETYPE_INCLUDE_DIRS};")
message(STATUS " Physics:${BULLET_INCLUDE_DIRS};")

enable_testing()
find_package(GTest REQUIRED)
if (BUILD_UNIT_TESTS)
enable_testing()
find_package(GTest REQUIRED)
endif ()

if (HAS_AV_LIBS)
# allow includes without AL/ prefix. Some openAL versions require this.
Expand All @@ -199,7 +207,7 @@ set(REGEN_LIBRARIES
${Boost_LIBRARIES}
${JSON_LIBRARIES}
${ASSIMP_LIBRARIES}
${FREETYPE_LIBRARIES} -lbrotlidec
${FREETYPE_LIBRARIES}
${IMG_LIBRARIES}
${AV_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
Expand Down Expand Up @@ -239,6 +247,10 @@ endif()
###########
###########

if(REGEN_EXTRA_INCLUDE_DIRS)
include_directories(${REGEN_EXTRA_INCLUDE_DIRS})
endif()

# allow includes like <regen/xxx.h> even if the engine is not installed
include_directories(.)
# allow include of generated files
Expand All @@ -260,19 +272,21 @@ install(FILES img/icon-small.png DESTINATION ${SHARE_INSTALL_PATH}/img)
########## Unit Testings
##############

# add an executable target for GTest.
# but the testing code is partly in the *knowrob* library
# where gtest won't find them without using the "--no-as-needed"
# flag for the linker.
add_executable(all_gtests
tests/gtests.cpp
tests/shapes/quad-tree-test.cpp)
target_link_libraries(all_gtests
-Wl,--whole-archive,--no-as-needed
regen
-Wl,--no-whole-archive
${Boost_Python_COMPONENT}
${GTEST_MAIN_LIBRARIES})
if (BUILD_UNIT_TESTS)
# add an executable target for GTest.
# but the testing code is partly in the *knowrob* library
# where gtest won't find them without using the "--no-as-needed"
# flag for the linker.
add_executable(all_gtests
tests/gtests.cpp
tests/shapes/quad-tree-test.cpp)
target_link_libraries(all_gtests
-Wl,--whole-archive,--no-as-needed
regen
-Wl,--no-whole-archive
${Boost_Python_COMPONENT}
${GTEST_MAIN_LIBRARIES})
endif ()

##############
########## packaging
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
<img src="img/gallery.gif" width="160" height="100" />
</p>

![CI](https://github.com/daniel86/regen/workflows/CI/badge.svg)
![Linux](https://github.com/daniel86/regen/actions/workflows/ci-linux.yml/badge.svg)
![MacOS](https://github.com/daniel86/regen/actions/workflows/ci-macos.yml/badge.svg)
![Warnings](https://img.shields.io/badge/compiler%20warnings-clean-brightgreen)
[![Docs](https://img.shields.io/badge/docs-online-blue)](https://daniel86.github.io/regen/)
![Debian](https://img.shields.io/badge/debian-.deb%20package-blue)
![GitHub release](https://img.shields.io/github/v/release/daniel86/regen?include_prereleases)
![License](https://img.shields.io/github/license/daniel86/regen)

`regen` -- **Real-time Graphics Engine** -- is a modular OpenGL-based C++ engine designed for research and experimentation in real-time rendering, GPU compute, and virtual world simulation.

Expand Down
18 changes: 9 additions & 9 deletions regen/compute/radix-sort-cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,31 +139,31 @@ namespace regen {
if constexpr (KEY_TYPE_BITS == 16) {
// Gather 8 keys manually, and promote to 32-bit
for (int k = 0; k < 8; ++k) tmpKeys32[k] = static_cast<int32_t>(keys[src[keyIdx+k]]);
r0 = _mm256_load_si256(reinterpret_cast<const __m256i*>(tmpKeys32));
r0 = _mm256_and_si256(_mm256_srli_epi32(r0, SHIFT), mask);
r0 = simde_mm256_load_si256(reinterpret_cast<const simde__m256i*>(tmpKeys32));
r0 = simde_mm256_and_si256(simde_mm256_srli_epi32(r0, SHIFT), mask);
keyIdx += 8; // processed 8 keys, not 16!
}
else if constexpr (KEY_TYPE_BITS == 32) {
simd::Register_i idx = _mm256_loadu_si256(reinterpret_cast<const __m256i*>(&src[keyIdx]));
simd::Register_i idx = simde_mm256_loadu_si256(reinterpret_cast<const simde__m256i*>(&src[keyIdx]));
// Gather 8 scattered keys, and apply shift and mask to get bucket ids
r0 = _mm256_i32gather_epi32(reinterpret_cast<const int*>(keys), idx, 4);
r0 = _mm256_and_si256(_mm256_srli_epi32(r0, SHIFT), mask);
r0 = simde_mm256_i32gather_epi32(reinterpret_cast<const int*>(keys), idx, 4);
r0 = simde_mm256_and_si256(simde_mm256_srli_epi32(r0, SHIFT), mask);
keyIdx += KEYS_PER_SIMD_PASS;
}
else if constexpr (KEY_TYPE_BITS == 64) {
// note: values have 32 bits, use __m128i to load only 4
__m128i idx32 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&src[keyIdx]));
simde__m128i idx32 = simde_mm_loadu_si128(reinterpret_cast<const simde__m128i*>(&src[keyIdx]));
// Gather 4 scattered keys, and apply shift and mask to get bucket ids
r0 = _mm256_i32gather_epi64(reinterpret_cast<const long long*>(keys), idx32, 8);
r0 = _mm256_and_si256(_mm256_srli_epi64(r0, SHIFT), mask);
r0 = simde_mm256_i32gather_epi64(reinterpret_cast<const long long*>(keys), idx32, 8);
r0 = simde_mm256_and_si256(simde_mm256_srli_epi64(r0, SHIFT), mask);
keyIdx += KEYS_PER_SIMD_PASS;
}
else {
static_assert("Unsupported key size for SIMD radix sort");
break;
}
// Store results into tmpBins_ and increment histogram
_mm256_storeu_si256(reinterpret_cast<__m256i*>(tmpBins_), r0);
simde_mm256_storeu_si256(reinterpret_cast<simde__m256i*>(tmpBins_), r0);
for (auto x : tmpBins_) ++histogram_[x];
}
}
Expand Down
Loading
Loading