Skip to content

Commit

Permalink
CI: Add windows x86 OpenGL2.0 Workflow (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonflylee authored Dec 11, 2023
1 parent fa46a65 commit ead0567
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 31 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
VERSION: ${{ env.VERSION }}
run: |
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_EXE=wiliwili-Windows-x64-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_EXE=wiliwili-Windows-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_UWP=wiliwili-windows-x64-uwp-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_NRO=wiliwili-NintendoSwitch-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_PS4=wiliwili-PS4-${VERSION}" >> $GITHUB_OUTPUT
Expand All @@ -87,7 +87,7 @@ jobs:
release:
needs: [ build-win-x64, build-switch, build-macos, build-flatpak, version ]
needs: [ build-win, build-switch, build-macos, build-flatpak, version ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
Expand All @@ -108,18 +108,25 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
artifacts: >
${{ needs.version.outputs.DIST_EXE }}/${{ needs.version.outputs.DIST_EXE }}.7z
${{ needs.version.outputs.DIST_EXE }}-GL3/${{ needs.version.outputs.DIST_EXE }}-x86_64-GL3.7z
${{ needs.version.outputs.DIST_EXE }}-GL2/${{ needs.version.outputs.DIST_EXE }}-i686-GL2.7z
${{ needs.version.outputs.DIST_NRO }}/${{ needs.version.outputs.DIST_NRO }}.tar.gz
${{ needs.version.outputs.DIST_INTEL_DMG }}/${{ needs.version.outputs.DIST_INTEL_DMG }}.dmg
${{ needs.version.outputs.DIST_ARM_DMG }}/${{ needs.version.outputs.DIST_ARM_DMG }}.dmg
${{ needs.version.outputs.DIST_UNIVERSAL_DMG }}/${{ needs.version.outputs.DIST_UNIVERSAL_DMG }}.dmg
${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}/${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}.flatpak
build-win-x64:
build-win:
needs: [ version ]
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
include:
- { msystem: MINGW64, driver: GL3 }
- { msystem: MINGW32, driver: GL2 }
env:
MSYSTEM: MINGW64
MSYSTEM: ${{ matrix.msystem }}
MSYS2_PATH_TYPE: inherit
defaults:
run:
Expand All @@ -144,8 +151,8 @@ jobs:
cmake -P ${BRLS_GLFW}/CMake/GenerateMappings.cmake ${BRLS_GLFW}/src/mappings.h.in ${BRLS_GLFW}/src/mappings.h
- name: Build dependency
run: |
curl -sL https://github.com/webmproject/libwebp/archive/v1.3.1.tar.gz | tar zxf - -C /tmp
cd /tmp/libwebp-1.3.1
curl -sL https://github.com/webmproject/libwebp/archive/v1.3.2.tar.gz | tar zxf - -C /tmp
cd /tmp/libwebp-1.3.2
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
Expand All @@ -167,6 +174,7 @@ jobs:
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM_DESKTOP=ON \
-DUSE_${{ matrix.driver }}=ON \
-DWIN32_TERMINAL=OFF \
-DCURL_DISABLE_PROGRESS_METER=ON \
-DUSE_LIBIDN2=OFF \
Expand All @@ -178,13 +186,14 @@ jobs:
cd build
strip wiliwili.exe
7z a -mx=9 ../${{ needs.version.outputs.DIST_EXE }}.7z wiliwili.exe resources ${MINGW_PREFIX}/bin/libmpv-2.dll
7z a -mx=9 ../${{ needs.version.outputs.DIST_EXE }}-${MSYSTEM_CARCH}-${{ matrix.driver }}.7z \
wiliwili.exe resources ${MINGW_PREFIX}/bin/libmpv-2.dll
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: ${{ needs.version.outputs.DIST_EXE }}
path: "${{ needs.version.outputs.DIST_EXE }}.7z"
name: ${{ needs.version.outputs.DIST_EXE }}-${{ matrix.driver }}
path: "${{ needs.version.outputs.DIST_EXE }}-*.7z"

build-win-uwp:
needs: [ version ]
Expand All @@ -201,7 +210,7 @@ jobs:
- name: Cache xmake packages
uses: actions/cache@v3
with:
key: ${{ runner.os }}-build
key: ${{ runner.os }}-xmake
path: |
${{ runner.temp }}/.xmake/packages
- name: build
Expand Down
33 changes: 19 additions & 14 deletions wiliwili/include/view/mpv_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,24 +301,27 @@ class MPVCore : public brls::Singleton<MPVCore> {
{MPV_RENDER_PARAM_SW_FORMAT, (void *)sw_format},
{MPV_RENDER_PARAM_SW_STRIDE, &pitch},
{MPV_RENDER_PARAM_SW_POINTER, pixels},
{ MPV_RENDER_PARAM_INVALID,
nullptr }};
{MPV_RENDER_PARAM_INVALID, nullptr},
};
#elif defined(BOREALIS_USE_DEKO3D)
DkFence doneFence;
DkFence readyFence;
mpv_deko3d_fbo mpv_fbo{nullptr, &readyFence, &doneFence,
1280, 720, DkImageFormat_RGBA8_Unorm};
mpv_render_param mpv_params[3] = {{MPV_RENDER_PARAM_DEKO3D_FBO, &mpv_fbo},
{ MPV_RENDER_PARAM_INVALID,
nullptr }};
mpv_deko3d_fbo mpv_fbo{
nullptr, &readyFence, &doneFence, 1280, 720, DkImageFormat_RGBA8_Unorm,
};
mpv_render_param mpv_params[3] = {
{MPV_RENDER_PARAM_DEKO3D_FBO, &mpv_fbo},
{MPV_RENDER_PARAM_INVALID, nullptr},
};
#elif defined(MPV_NO_FB)
GLint default_framebuffer = 0;
mpv_opengl_fbo mpv_fbo{0, 1920, 1080};
int flip_y{1};
mpv_render_param mpv_params[3] = {{MPV_RENDER_PARAM_OPENGL_FBO, &mpv_fbo},
{MPV_RENDER_PARAM_FLIP_Y, &flip_y},
{ MPV_RENDER_PARAM_INVALID,
nullptr }};
mpv_render_param mpv_params[3] = {
{MPV_RENDER_PARAM_OPENGL_FBO, &mpv_fbo},
{MPV_RENDER_PARAM_FLIP_Y, &flip_y},
{MPV_RENDER_PARAM_INVALID, nullptr},
};
#else
GLint default_framebuffer = 0;
GLuint media_framebuffer = 0;
Expand All @@ -327,9 +330,11 @@ class MPVCore : public brls::Singleton<MPVCore> {
mpv_opengl_fbo mpv_fbo{0, 1920, 1080};
int flip_y{1};
bool redraw = false;
mpv_render_param mpv_params[3] = {{MPV_RENDER_PARAM_OPENGL_FBO, &mpv_fbo},
{MPV_RENDER_PARAM_FLIP_Y, &flip_y},
{MPV_RENDER_PARAM_INVALID, nullptr}};
mpv_render_param mpv_params[3] = {
{MPV_RENDER_PARAM_OPENGL_FBO, &mpv_fbo},
{MPV_RENDER_PARAM_FLIP_Y, &flip_y},
{MPV_RENDER_PARAM_INVALID, nullptr},
};
float vertices[20] = {1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f,
0.0f, 1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 0.0f,
0.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f};
Expand Down
10 changes: 4 additions & 6 deletions wiliwili/source/view/mpv_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void MPVCore::on_update(void *self) {
brls::sync([]() {
uint64_t flags =
mpv_render_context_update(MPVCore::instance().getContext());
#if defined(MPV_NO_FB) || defined(BOREALIS_USE_DEKO3D)
#if defined(MPV_NO_FB) || defined(BOREALIS_USE_DEKO3D) || defined(USE_GL2)
(void)flags;
#else
MPVCore::instance().redraw = flags & MPV_RENDER_UPDATE_FRAME;
Expand Down Expand Up @@ -443,9 +443,7 @@ void MPVCore::initializeVideo() {
#if defined(MPV_NO_FB)
mpv_fbo.fbo = default_framebuffer;
glBindFramebuffer(GL_FRAMEBUFFER, default_framebuffer);
#elif defined(MPV_SW_RENDER)
#elif defined(BOREALIS_USE_DEKO3D)
#else
#elif defined(MPV_USE_FB)
if (this->media_texture != 0) return;
brls::Logger::debug("initializeGL");

Expand Down Expand Up @@ -566,7 +564,7 @@ void MPVCore::setFrameSize(brls::Rect r) {
// 在视频暂停时调整纹理尺寸,视频画面会被清空为黑色,强制重新绘制一次,避免这个问题
mpv_render_context_render(mpv_context, mpv_params);
mpv_render_context_report_swap(mpv_context);
#elif defined(MPV_NO_FB) || defined(BOREALIS_USE_DEKO3D)
#elif !defined(MPV_USE_FB)
// Using default framebuffer
this->mpv_fbo.w = brls::Application::windowWidth;
this->mpv_fbo.h = brls::Application::windowHeight;
Expand Down Expand Up @@ -647,7 +645,7 @@ void MPVCore::draw(brls::Rect area, float alpha) {
nvgFillPaint(vg, nvgImagePattern(vg, 0, 0, rect.getWidth(),
rect.getHeight(), 0, nvg_image, alpha));
nvgFill(vg);
#elif defined(MPV_NO_FB) || defined(BOREALIS_USE_DEKO3D)
#elif !defined(MPV_USE_FB)
// 只在非透明时绘制视频,可以避免退出页面时视频画面残留
if (alpha >= 1) {
#ifdef BOREALIS_USE_DEKO3D
Expand Down

0 comments on commit ead0567

Please sign in to comment.