mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 10:35:44 +00:00
Fix macOS tests
Main thread locking hangs OpenGL emulators.
This commit is contained in:
parent
a4f0dbbca8
commit
9b56ffc87c
5 changed files with 21 additions and 4 deletions
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, macos-13, windows-latest ]
|
||||
os: [ ubuntu-latest, macos-12, windows-latest ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -42,7 +42,7 @@ jobs:
|
|||
xvfb-run --auto-servernum make test verify-cores
|
||||
|
||||
- name: macOS
|
||||
if: matrix.os == 'macos-13'
|
||||
if: matrix.os == 'macos-12'
|
||||
run: |
|
||||
brew install pkg-config libvpx x264 opus sdl2 jpeg-turbo
|
||||
make build test verify-cores
|
||||
|
|
|
|||
|
|
@ -169,6 +169,8 @@ func (n *Nanoarch) CoreLoad(meta Metadata) {
|
|||
n.Video.gl.autoCtx = meta.AutoGlContext
|
||||
n.Video.gl.enabled = meta.IsGlAllowed
|
||||
|
||||
thread.SwitchGraphics(n.Video.gl.enabled)
|
||||
|
||||
// hacks
|
||||
Nan0.hackSkipHwContextDestroy = meta.HasHack("skip_hw_context_destroy")
|
||||
|
||||
|
|
@ -868,6 +870,7 @@ func deinitVideo() {
|
|||
Nan0.Video.gl.enabled = false
|
||||
Nan0.Video.gl.autoCtx = false
|
||||
Nan0.hackSkipHwContextDestroy = false
|
||||
thread.SwitchGraphics(false)
|
||||
}
|
||||
|
||||
type limit struct {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ type fun struct {
|
|||
var dPool = sync.Pool{New: func() any { return make(chan struct{}) }}
|
||||
var fq = make(chan fun, runtime.GOMAXPROCS(0))
|
||||
|
||||
var isGraphics = false
|
||||
|
||||
func init() {
|
||||
runtime.LockOSThread()
|
||||
}
|
||||
|
|
@ -38,8 +40,17 @@ func Run(run func()) {
|
|||
|
||||
// Call queues function f on the main thread and blocks until the function f finishes.
|
||||
func Call(f func()) {
|
||||
if !isGraphics {
|
||||
f()
|
||||
return
|
||||
}
|
||||
|
||||
done := dPool.Get().(chan struct{})
|
||||
defer dPool.Put(done)
|
||||
fq <- fun{fn: f, done: done}
|
||||
<-done
|
||||
}
|
||||
|
||||
func Switch(s bool) {
|
||||
isGraphics = s
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
|
||||
package thread
|
||||
|
||||
func Wrap(f func()) { f() }
|
||||
func Main(f func()) { f() }
|
||||
func Wrap(f func()) { f() }
|
||||
func Main(f func()) { f() }
|
||||
func SwitchGraphics(s bool) {}
|
||||
|
|
|
|||
|
|
@ -8,3 +8,5 @@ func Wrap(f func()) { Run(f) }
|
|||
|
||||
// Main calls a function on the main thread.
|
||||
func Main(f func()) { Call(f) }
|
||||
|
||||
func SwitchGraphics(s bool) { Switch(s) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue