-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use cpp in Cython code to avoid c trampoline, cleanup.
- Loading branch information
Showing
4 changed files
with
24 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
cdef extern from "egl_angle_metal_implem.h": | ||
ctypedef void *metalangle_context_t | ||
ctypedef void *metalangle_nativelayer_t | ||
metalangle_context_t metalangle_create_context(void * nativeMetalLayer) | ||
void metalangle_swap_buffers(metalangle_context_t context) | ||
cdef extern from "egl_angle_metal_implem.mm": | ||
cppclass MetalANGLEGraphicsContext: | ||
MetalANGLEGraphicsContext(void* nativeMetalLayer) | ||
void swapBuffersEGL() | ||
|
||
|
||
cdef class EGLMetalANGLE: | ||
cdef metalangle_context_t ctx | ||
cdef metalangle_nativelayer_t native_layer | ||
cdef MetalANGLEGraphicsContext* ctx | ||
cdef void* native_layer | ||
|
||
def __cinit__(self): | ||
self.native_layer = NULL | ||
self.ctx = NULL | ||
|
||
cdef void set_native_layer(self, void * native_layer) except *: | ||
self.native_layer = <metalangle_nativelayer_t>native_layer | ||
self.native_layer = native_layer | ||
|
||
def swap_buffers(self): | ||
metalangle_swap_buffers(self.ctx) | ||
self.ctx.swapBuffersEGL() | ||
|
||
def create_context(self): | ||
self.ctx = metalangle_create_context(self.native_layer) | ||
self.ctx = new MetalANGLEGraphicsContext(self.native_layer) | ||
|
||
def destroy_context(self): | ||
pass | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters