Fix errors/misuse with OpenGL-based core API (#237)

* Follow Go standard for naming constants

* Use reformatted pixFormats for Libretro cores

* Use OpenGL 2.1 Core profile bindings for render instead 4.1

* Cleanup the code

* SDL attributes should be set before the sdl.Init call

* Use simple vertical frame flip function instead imaging lib with OpenGL renderer

* Use the separate control flow for the macOS OpenGL context handling

* Add OpenGL pixel type/format switch based on cores callback

* Use unified log instead of fmt

* Clean code

* Remove unnecessary SDL init flag

* Printout errors with SDL / OpenGL functions

* Add CGO Libretro logging output

* Use main thread lock for windows and OpenGL context

* Remove Darwin OS switch

* Add extended OpenGL version info print

* Update Libretro cores info print

* Add game library module (#232)

* Add game library

* Add missing local game lib files

* Add missing return statement

* Use v2 suffix

* Bump the dependencies

* Update Libretro modules to support headless test runners

* Port old savestates tests as example for Libretro cores runner testing

* Add n64 core example game and a test

* Update room tests for various games

* Add frame dump support for CI builds

* Add frame rendering to image output for core testing

* Update ROM frame exporter in tests

* Disable Docker image publishing

* Add frame rendering output for non-gl cores for CI

* Add auto GL context override for headless, gpu-less machines (e.g. Github CI Xeon)

* Add Windows CI headless cores frame render config

* Add missing Mesa OpenGL drivers to Ubuntu CI

* Add mupen n64 core download into CI tests

* Add Linux, macOS, Windows core frame render tests into CI

* Remove unnecessary var

* Add some comments

* Revert Y flip

* Move OpenGL into a separate package

* Add SDL package

* Update modules
This commit is contained in:
sergystepanov 2020-11-04 13:59:12 +03:00 committed by GitHub
parent 50762e95c7
commit bd6e146e64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 1509 additions and 350 deletions

View file

@ -1,9 +1,8 @@
# ------------------------------------------------------------------------
# Build workflow for multiple OSes (Linux x64, macOS x64, Windows x64)
# ------------------------------------------------------------------------
# ------------------------------------------------------------
# Build workflow (Linux x64, macOS x64, Windows x64)
# ------------------------------------------------------------
name: build
# run only when pushing into the master only
on:
push:
branches:
@ -13,34 +12,27 @@ on:
pull_request:
branches:
- master
env:
go-version: 1.14
jobs:
build:
name: Build
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Get the source
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v1
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }}
- name: Set up Go environment
shell: bash
# add Go's bin folder into environment (to be able to call its tools)
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
go-version: ^1.15
- name: Get Linux dev libraries and tools
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y make pkg-config libvpx-dev libopus-dev libopusfile-dev libsdl2-dev
sudo apt-get install -y make pkg-config libvpx-dev libopus-dev libopusfile-dev libsdl2-dev libgl1-mesa-glx
- name: Get MacOS dev libraries and tools
if: matrix.os == 'macos-latest'
@ -54,9 +46,16 @@ jobs:
msystem: MINGW64
path-type: inherit
update: true
install: >
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-dlfcn
mingw-w64-x86_64-libvpx
mingw-w64-x86_64-opusfile
mingw-w64-x86_64-SDL2
- name: Load Go modules maybe?
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@ -66,14 +65,14 @@ jobs:
- name: Build Windows app
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: >
pacman -S --noconfirm --needed make
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-dlfcn
mingw-w64-x86_64-libvpx
mingw-w64-x86_64-opusfile
mingw-w64-x86_64-SDL2
run: |
wget -q https://github.com/pal1000/mesa-dist-win/releases/download/20.2.1/mesa3d-20.2.1-release-mingw.7z
"/c/Program Files/7-Zip/7z.exe" x mesa3d-20.2.1-release-mingw.7z -omesa
echo -e " 2\r\n 8\r\n " >> commands
./mesa/systemwidedeploy.cmd < ./commands
wget -q https://buildbot.libretro.com/nightly/windows/x86_64/latest/mupen64plus_next_libretro.dll.zip
"/c/Program Files/7-Zip/7z.exe" x mupen64plus_next_libretro.dll.zip -oassets/emulator/libretro/cores
make build
@ -87,6 +86,30 @@ jobs:
run: |
make build
- name: Verify core rendering (windows-latest)
if: matrix.os == 'windows-latest' && always()
shell: msys2 {0}
env:
MESA_GL_VERSION_OVERRIDE: 3.3COMPAT
run: |
go test -run TestAllEmulatorRooms ./pkg/worker/room -v -renderFrames -autoGlContext -outputPath "../../../_rendered"
- name: Verify core rendering (ubuntu-latest)
if: matrix.os == 'ubuntu-latest' && always()
env:
MESA_GL_VERSION_OVERRIDE: 3.3COMPAT
run: |
xvfb-run --auto-servernum go test -run TestAllEmulatorRooms ./pkg/worker/room -v -renderFrames -autoGlContext -outputPath "../../../_rendered"
- name: Verify core rendering (macos-latest)
if: matrix.os == 'macos-latest' && always()
run: |
go test -run TestAllEmulatorRooms ./pkg/worker/room -v -renderFrames -outputPath "../../../_rendered"
- uses: actions/upload-artifact@v2
with:
path: _rendered/*.png
docker_build_check:
name: Build (docker)
runs-on: ubuntu-latest

View file

@ -24,7 +24,7 @@ on:
tags:
- 'v*'
env:
go-version: 1.14
go-version: 1.15
app-name: cloud-game
app-arch: x86_64
jobs:
@ -41,15 +41,9 @@ jobs:
- name: Get the source
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }}
- name: Set up Go environment
shell: bash
# add Go's bin folder into environment (to be able to call its tools)
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
- name: Get Linux dev libraries and tools
if: matrix.os == 'ubuntu-latest'
@ -71,7 +65,7 @@ jobs:
update: true
- name: Load Go modules maybe?
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}