File tree Expand file tree Collapse file tree 8 files changed +11
-26
lines changed
shiny/driver/mtldriver/internal Expand file tree Collapse file tree 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
33go 1.12
44
55require (
6- dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9
6+ dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037
77 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802
88 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4
99 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 =
33github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc =
44github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 /go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo =
55github.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 (
2121)
2222
2323/*
24+ #include <stdbool.h>
2425#include "appkit.h"
2526*/
2627import "C"
@@ -63,12 +64,5 @@ func (v View) SetLayer(l coreanim.Layer) {
6364//
6465// Reference: https://developer.apple.com/documentation/appkit/nsview/1483695-wantslayer.
6566func (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 ))
7468}
Original file line number Diff line number Diff line change 44
55// +build darwin
66
7- typedef signed char BOOL ;
8-
97void * Window_ContentView (void * window );
108
119void 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) {
1515 ((NSView *)view).layer = (CALayer *)layer;
1616}
1717
18- void View_SetWantsLayer (void * view, BOOL wantsLayer) {
18+ void View_SetWantsLayer (void * view, bool wantsLayer) {
1919 ((NSView *)view).wantsLayer = wantsLayer;
2020}
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
2323
2424/*
2525#cgo LDFLAGS: -framework QuartzCore -framework Foundation
26+ #include <stdbool.h>
2627#include "coreanim.h"
2728*/
2829import "C"
@@ -99,7 +100,7 @@ func (ml MetalLayer) SetMaximumDrawableCount(count int) {
99100//
100101// Reference: https://developer.apple.com/documentation/quartzcore/cametallayer/2887087-displaysyncenabled.
101102func (ml MetalLayer ) SetDisplaySyncEnabled (enabled bool ) {
102- C .MetalLayer_SetDisplaySyncEnabled (ml .metalLayer , toCBool (enabled ))
103+ C .MetalLayer_SetDisplaySyncEnabled (ml .metalLayer , C . bool (enabled ))
103104}
104105
105106// 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 }
137138func (md MetalDrawable ) Texture () mtl.Texture {
138139 return mtl .NewTexture (C .MetalDrawable_Texture (md .metalDrawable ))
139140}
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 44
55// +build darwin
66
7- typedef signed char BOOL ;
87typedef unsigned long uint_t ;
98typedef unsigned short uint16_t ;
109
@@ -14,7 +13,7 @@ uint16_t MetalLayer_PixelFormat(void * metalLayer);
1413void MetalLayer_SetDevice (void * metalLayer , void * device );
1514const char * MetalLayer_SetPixelFormat (void * metalLayer , uint16_t pixelFormat );
1615const char * MetalLayer_SetMaximumDrawableCount (void * metalLayer , uint_t maximumDrawableCount );
17- void MetalLayer_SetDisplaySyncEnabled (void * metalLayer , BOOL displaySyncEnabled );
16+ void MetalLayer_SetDisplaySyncEnabled (void * metalLayer , bool displaySyncEnabled );
1817void MetalLayer_SetDrawableSize (void * metalLayer , double width , double height );
1918void * MetalLayer_NextDrawable (void * metalLayer );
2019
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ void MetalLayer_SetDevice(void * metalLayer, void * device) {
4141 return NULL ;
4242}
4343
44- void MetalLayer_SetDisplaySyncEnabled (void * metalLayer, BOOL displaySyncEnabled) {
44+ void MetalLayer_SetDisplaySyncEnabled (void * metalLayer, bool displaySyncEnabled) {
4545 ((CAMetalLayer *)metalLayer).displaySyncEnabled = displaySyncEnabled;
4646}
4747
You can’t perform that action at this time.
0 commit comments