Skip to content

Commit

Permalink
CI/CD: Update m64p implementation...
Browse files Browse the repository at this point in the history
  • Loading branch information
Jj0YzL5nvJ committed May 16, 2023
1 parent 6c66075 commit 900f1e5
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 19 deletions.
202 changes: 202 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
name: ParaLLEl RDP

on:
push:
paths-ignore:
- '**/*.md'
- '.{gitattributes,gitignore,travis.yml}'
- 'appveyor.yml,README'
pull_request:
paths-ignore:
- '**/*.md'
- '.{gitattributes,gitignore,travis.yml}'
- 'appveyor.yml,README'
workflow_dispatch:

jobs:

Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
platform: x64
- cc: GCC
platform: x86
- cc: Clang
platform: x64
- cc: Clang
platform: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.platform }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Get build dependencies and arrange the environment
run: |
echo "G_REV=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}"
if [[ "${{ matrix.platform }}" == "x86" ]]; then sudo dpkg --add-architecture i386; fi
sudo apt-get update
sudo apt-get -y install cmake libgl1-mesa-dev libopengl-dev
if [[ "${{ matrix.platform }}" == "x86" ]]; then sudo apt-get --reinstall -y install gcc-multilib g++-multilib libc6 libc6-dev-i386 libatomic1:i386 libgcc-s1:i386 libgl1-mesa-dev:i386 libopengl-dev:i386 libstdc++6:i386; fi
sudo ldconfig
- name: Build and related stuff, backup binaries
run: |
if [[ "${{ matrix.platform }}" == "x86" ]]; then CPU_TUNE="-m32 -msse2 -mtune=pentium4"; else CPU_TUNE="-mtune=core2"; fi
CC="gcc"
CXX="g++"
if [[ "${{ matrix.cc }}" != "GCC" ]]; then
CC="clang"
CXX="clang++"
fi
${CC} --version
echo ""
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
echo ""
mkdir -p build pkg/usr/local/lib/mupen64plus
cd build
cmake -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_C_FLAGS="${CPU_TUNE}" -DCMAKE_CXX_FLAGS="${CPU_TUNE}" -DCMAKE_BUILD_TYPE="Release" ..
cmake --build . -j2
echo ""
chmod 644 *.so
cp *.so ../pkg/usr/local/lib/mupen64plus/
ls -gG ../pkg/usr/local/lib/mupen64plus/*.so
echo ""
ldd ../pkg/usr/local/lib/mupen64plus/mupen64plus-video-parallel.so
tar cvzf ../pkg/mupen64plus-video-parallel-linux-${{ matrix.platform }}-g${{ env.G_REV }}.tar.gz -C ../pkg/ "usr"
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v3
with:
name: mupen64plus-video-parallel-linux-${{ matrix.platform }}-g${{ env.G_REV }}
path: pkg/*.tar.gz

Windows:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
platform: x64
cross: x86_64
bits: 64
- cc: GCC
platform: x86
cross: i686
bits: 32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.platform }}
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW${{ matrix.bits }}
update: true
install: >-
git
libtool
mingw-w64-${{ matrix.cross }}-cmake
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-ninja
mingw-w64-${{ matrix.cross }}-toolchain
- name: Build and related stuff, backup binaries
run: |
echo "G_REV=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}"
if [[ ${{ matrix.bits }} -eq 32 ]]; then CPU_TUNE="-m32 -msse2 -mtune=pentium4"; else CPU_TUNE="-mtune=core2"; fi
CC="gcc"
CXX="g++"
${CC} --version
echo ""
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
echo ""
mkdir build pkg
cd build
cmake -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_C_FLAGS="${CPU_TUNE}" -DCMAKE_CXX_FLAGS="${CPU_TUNE}" -G "Ninja" -DCMAKE_BUILD_TYPE="Release" ..
cmake --build . -j2
echo ""
chmod 644 *.dll
cp *.dll ../pkg/
ls -gG ../pkg/*.dll
echo ""
ldd ../pkg/mupen64plus-video-parallel.dll
- name: Backup dependencies, etc...
run: |
if [[ ${{ matrix.bits }} -eq 32 ]]; then LIBGCC="libgcc_s_dw2-1"; else LIBGCC="libgcc_s_seh-1"; fi
for LIB in ${LIBGCC} libstdc++-6 libwinpthread-1; do
echo ":: Copying ${LIB}.dll"
cp "/mingw${{ matrix.bits }}/bin/${LIB}.dll" pkg/
done
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: mupen64plus-video-parallel-msys2-${{ matrix.platform }}-g${{ env.G_REV }}
path: pkg/*

Nightly-build:
runs-on: ubuntu-latest
if: github.ref_name == 'ci-m64p'
needs: [Linux, Windows]
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: binaries
- name: Get some tools
run: |
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
mkdir pkg
cd binaries
for BIN in *; do
cd "${BIN}"
if [[ "${BIN:27:4}" == "msys" ]]; then
echo ":: Creating ${BIN}.zip"
zip -r "../../pkg/${BIN}.zip" *
else
echo ":: Recovering ${BIN}.tar.gz"
mv *.tar.gz ../../pkg/
fi
cd ..
done
cd ../pkg
echo ""
for BIN in *; do
ls -gG ${BIN}
tigerdeep -lz ${BIN} >> ../${BIN:0:26}.tiger.txt
sha256sum ${BIN} >> ../${BIN:0:26}.sha256.txt
sha512sum ${BIN} >> ../${BIN:0:26}.sha512.txt
b2sum ${BIN} >> ../${BIN:0:26}.blake2.txt
done
mv ../*.tiger.txt .
mv ../*.sha*.txt .
mv ../*.blake2.txt .
echo ""
echo "TIGER:"
cat *.tiger.txt
echo ""
echo "SHA256:"
cat *.sha256.txt
echo ""
echo "SHA512:"
cat *.sha512.txt
echo ""
echo "BLAKE2:"
cat *.blake2.txt
echo ""
git tag -f nightly-build
git push -f origin nightly-build
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*
38 changes: 21 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_C_STANDARD 99)
cmake_minimum_required(VERSION 3.22)

project(parallel-rdp LANGUAGES CXX C)

set(OpenGL_GL_PREFERENCE GLVND)

set(NAME_PLUGIN_M64P "mupen64plus-video-parallel")
include_directories(../mupen64plus-core/src/api)
add_definitions(-DM64P_PLUGIN_API -DGRANITE_VULKAN_MT)
add_definitions(-DM64P_PLUGIN_API)

# check for INTERPROCEDURAL_OPTIMIZATION support
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT ENABLE_IPO)

include(CheckIPOSupported)
check_ipo_supported(RESULT ENABLE_IPO)
if(ENABLE_IPO)
message("Interprocedural optimizations enabled")
endif(ENABLE_IPO)
endif()

if(ENABLE_IPO AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
if(ENABLE_IPO AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
message("Interprocedural optimizations enabled")
endif()

find_package(OpenGL REQUIRED)
if(WIN32)
find_package(OpenGL REQUIRED)
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
endif()

Expand Down Expand Up @@ -52,6 +46,8 @@ add_library(${NAME_PLUGIN_M64P} SHARED
vulkan/semaphore_manager.cpp
vulkan/shader.cpp
vulkan/texture_format.cpp
vulkan/wsi.cpp
util/arena_allocator.cpp
util/logging.cpp
util/thread_id.cpp
util/aligned_alloc.cpp
Expand All @@ -72,6 +68,14 @@ target_include_directories(${NAME_PLUGIN_M64P} PUBLIC

if(WIN32)
target_link_libraries(${NAME_PLUGIN_M64P} ${OPENGL_LIBRARIES} -lwinmm)
endif()
else(WIN32)
target_link_libraries(${NAME_PLUGIN_M64P} ${OPENGL_LIBRARIES})
endif(WIN32)

set_property(TARGET ${NAME_PLUGIN_M64P} PROPERTY C_VISIBILITY_PRESET hidden)
set_property(TARGET ${NAME_PLUGIN_M64P} PROPERTY CXX_VISIBILITY_PRESET hidden)
set_property(TARGET ${NAME_PLUGIN_M64P} PROPERTY VISIBILITY_INLINES_HIDDEN ON)
if(NOT APPLE)
target_link_options(${NAME_PLUGIN_M64P} PRIVATE -Wl,-Bsymbolic -Wl,-Bsymbolic-functions)
endif(NOT APPLE)
set_target_properties(${NAME_PLUGIN_M64P} PROPERTIES PREFIX "")
2 changes: 1 addition & 1 deletion glguts.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void screen_init()

glGenBuffers(1, &buffer);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer);
glBufferStorage(GL_PIXEL_UNPACK_BUFFER, buffer_size * TEX_NUM, 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
glBufferStorage(GL_PIXEL_UNPACK_BUFFER, buffer_size * TEX_NUM, 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_CLIENT_STORAGE_BIT);
buffer_data = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, buffer_size * TEX_NUM, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);

glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
Expand Down
6 changes: 5 additions & 1 deletion parallel_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ void vk_process_commands()
if ((cmd_ptr + length) & ~(0x0003FFFF >> 3))
return;

*GET_GFX_INFO(DPC_STATUS_REG) |= DP_STATUS_PIPE_BUSY | DP_STATUS_START_GCLK;

uint32_t offset = DP_CURRENT;
if (*GET_GFX_INFO(DPC_STATUS_REG) & DP_STATUS_XBUS_DMA)
{
Expand Down Expand Up @@ -197,6 +199,7 @@ void vk_process_commands()
if (vk_synchronous && frontend)
frontend->wait_for_timeline(frontend->signal_timeline());
*gfx.MI_INTR_REG |= DP_INTERRUPT;
*GET_GFX_INFO(DPC_STATUS_REG) &= ~(DP_STATUS_PIPE_BUSY | DP_STATUS_START_GCLK);
gfx.CheckInterrupts();
}

Expand All @@ -205,7 +208,8 @@ void vk_process_commands()

cmd_ptr = 0;
cmd_cur = 0;
*GET_GFX_INFO(DPC_START_REG) = *GET_GFX_INFO(DPC_CURRENT_REG) = *GET_GFX_INFO(DPC_END_REG);
*GET_GFX_INFO(DPC_CURRENT_REG) = *GET_GFX_INFO(DPC_END_REG);
*GET_GFX_INFO(DPC_STATUS_REG) |= DP_STATUS_CBUF_READY;
}
}

Expand Down

0 comments on commit 900f1e5

Please sign in to comment.