File tree 8 files changed +11
-26
lines changed
shiny/driver/mtldriver/internal 8 files changed +11
-26
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module golang.org/x/exp
3
3
go 1.12
4
4
5
5
require (
6
- dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9
6
+ dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037
7
7
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802
8
8
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4
9
9
golang.org/x/image v0.0.0-20190802002840-cff245a6509b
Original file line number Diff line number Diff line change 1
- dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY =
2
- dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 /go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU =
1
+ dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037 h1:+PdD6GLKejR9DizMAKT5DpSAkKswvZrurk1/eEt9+pw =
2
+ dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037 /go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU =
3
3
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc =
4
4
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 /go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo =
5
5
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I =
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
21
21
)
22
22
23
23
/*
24
+ #include <stdbool.h>
24
25
#include "appkit.h"
25
26
*/
26
27
import "C"
@@ -63,12 +64,5 @@ func (v View) SetLayer(l coreanim.Layer) {
63
64
//
64
65
// Reference: https://developer.apple.com/documentation/appkit/nsview/1483695-wantslayer.
65
66
func (v View ) SetWantsLayer (wantsLayer bool ) {
66
- C .View_SetWantsLayer (v .view , toCBool (wantsLayer ))
67
- }
68
-
69
- func toCBool (b bool ) C.BOOL {
70
- if b {
71
- return 1
72
- }
73
- return 0
67
+ C .View_SetWantsLayer (v .view , C .bool (wantsLayer ))
74
68
}
Original file line number Diff line number Diff line change 4
4
5
5
// +build darwin
6
6
7
- typedef signed char BOOL ;
8
-
9
7
void * Window_ContentView (void * window );
10
8
11
9
void View_SetLayer (void * view , void * layer );
12
- void View_SetWantsLayer (void * view , BOOL wantsLayer );
10
+ void View_SetWantsLayer (void * view , bool wantsLayer );
Original file line number Diff line number Diff line change @@ -15,6 +15,6 @@ void View_SetLayer(void * view, void * layer) {
15
15
((NSView *)view).layer = (CALayer *)layer;
16
16
}
17
17
18
- void View_SetWantsLayer (void * view, BOOL wantsLayer) {
18
+ void View_SetWantsLayer (void * view, bool wantsLayer) {
19
19
((NSView *)view).wantsLayer = wantsLayer;
20
20
}
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
23
23
24
24
/*
25
25
#cgo LDFLAGS: -framework QuartzCore -framework Foundation
26
+ #include <stdbool.h>
26
27
#include "coreanim.h"
27
28
*/
28
29
import "C"
@@ -99,7 +100,7 @@ func (ml MetalLayer) SetMaximumDrawableCount(count int) {
99
100
//
100
101
// Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/2887087-displaysyncenabled.
101
102
func (ml MetalLayer ) SetDisplaySyncEnabled (enabled bool ) {
102
- C .MetalLayer_SetDisplaySyncEnabled (ml .metalLayer , toCBool (enabled ))
103
+ C .MetalLayer_SetDisplaySyncEnabled (ml .metalLayer , C . bool (enabled ))
103
104
}
104
105
105
106
// SetDrawableSize sets the size, in pixels, of textures for rendering layer content.
@@ -137,10 +138,3 @@ func (md MetalDrawable) Drawable() unsafe.Pointer { return md.metalDrawable }
137
138
func (md MetalDrawable ) Texture () mtl.Texture {
138
139
return mtl .NewTexture (C .MetalDrawable_Texture (md .metalDrawable ))
139
140
}
140
-
141
- func toCBool (b bool ) C.BOOL {
142
- if b {
143
- return 1
144
- }
145
- return 0
146
- }
Original file line number Diff line number Diff line change 4
4
5
5
// +build darwin
6
6
7
- typedef signed char BOOL ;
8
7
typedef unsigned long uint_t ;
9
8
typedef unsigned short uint16_t ;
10
9
@@ -14,7 +13,7 @@ uint16_t MetalLayer_PixelFormat(void * metalLayer);
14
13
void MetalLayer_SetDevice (void * metalLayer , void * device );
15
14
const char * MetalLayer_SetPixelFormat (void * metalLayer , uint16_t pixelFormat );
16
15
const char * MetalLayer_SetMaximumDrawableCount (void * metalLayer , uint_t maximumDrawableCount );
17
- void MetalLayer_SetDisplaySyncEnabled (void * metalLayer , BOOL displaySyncEnabled );
16
+ void MetalLayer_SetDisplaySyncEnabled (void * metalLayer , bool displaySyncEnabled );
18
17
void MetalLayer_SetDrawableSize (void * metalLayer , double width , double height );
19
18
void * MetalLayer_NextDrawable (void * metalLayer );
20
19
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ void MetalLayer_SetDevice(void * metalLayer, void * device) {
41
41
return NULL ;
42
42
}
43
43
44
- void MetalLayer_SetDisplaySyncEnabled (void * metalLayer, BOOL displaySyncEnabled) {
44
+ void MetalLayer_SetDisplaySyncEnabled (void * metalLayer, bool displaySyncEnabled) {
45
45
((CAMetalLayer *)metalLayer).displaySyncEnabled = displaySyncEnabled;
46
46
}
47
47
You can’t perform that action at this time.
0 commit comments