Skip to content

Commit

Permalink
shiny/driver/mtldriver: update to GLFW 3.3.2
Browse files Browse the repository at this point in the history
Update to a newer v3.3/glfw pseudo-version, which uses GLFW 3.3.2.

GLFW 3.3.2 includes a fix for glfw/glfw#1543 (go-gl/glfw#262),
which makes it possible to remove the workaround for it from mtldriver.

However, there is a new regression glfw/glfw#1649 (go-gl/glfw#272).
Fortunately, it's a smaller issue. Add a temporary workaround for it.

Also update comment in two internal packages. The upstream names were
modified in https://dmitri.shuralyov.com/gpu/mtl/...$commit/11308bd612348edeca0d8fddca07bc5a4dfbb35c
to match the names used here.

Change-Id: I3199f16890efd539d62d8914b92260f8a614449a
Reviewed-on: https://go-review.googlesource.com/c/exp/+/220639
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
  • Loading branch information
dmitshur committed Feb 24, 2020
1 parent 7c80518 commit 6cc2880
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.12
require (
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4
golang.org/x/image v0.0.0-20190802002840-cff245a6509b
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUu
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72 h1:b+9H1GAsx5RsjvDFLoS5zkNBzIQMuVKUYQDmxU3N5XE=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down
2 changes: 1 addition & 1 deletion shiny/driver/mtldriver/internal/appkit/appkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// It's a minimal implementation with scope limited to
// supporting mtldriver.
//
// It was copied from dmitri.shuralyov.com/gpu/mtl/example/movingtriangle/internal/ns.
// It was copied from dmitri.shuralyov.com/gpu/mtl/example/movingtriangle/internal/appkit.
package appkit

import (
Expand Down
2 changes: 1 addition & 1 deletion shiny/driver/mtldriver/internal/coreanim/coreanim.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// It's a minimal implementation with scope limited to
// supporting mtldriver.
//
// It was copied from dmitri.shuralyov.com/gpu/mtl/example/movingtriangle/internal/ca.
// It was copied from dmitri.shuralyov.com/gpu/mtl/example/movingtriangle/internal/coreanim.
package coreanim

import (
Expand Down
14 changes: 6 additions & 8 deletions shiny/driver/mtldriver/mtldriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ func main(f func(screen.Screen)) error {
}
defer glfw.Terminate()
glfw.WindowHint(glfw.ClientAPI, glfw.NoAPI)
{
// TODO(dmitshur): Delete this when https://github.com/go-gl/glfw/issues/272 is resolved.
// Post an empty event from the main thread before it can happen in a non-main thread,
// to work around https://github.com/glfw/glfw/issues/1649.
glfw.PostEmptyEvent()
}
var (
done = make(chan struct{})
newWindowCh = make(chan newWindowReq, 1)
Expand All @@ -67,14 +73,6 @@ func main(f func(screen.Screen)) error {
close(done)
glfw.PostEmptyEvent() // Break main loop out of glfw.WaitEvents so it can receive on done.
}()
select {
// TODO(dmitshur): Delete this when https://github.com/go-gl/glfw/issues/262 is resolved.
// Wait for first window request (or done) before entering main
// loop to work around https://github.com/glfw/glfw/issues/1543.
case w := <-newWindowCh:
newWindowCh <- w
case <-done:
}
for {
select {
case <-done:
Expand Down

0 comments on commit 6cc2880

Please sign in to comment.