Skip to content

Commit

Permalink
add GetMetalLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
smallshen authored and tonsky committed Oct 30, 2023
1 parent 2a9843b commit 79ab287
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions macos/cc/LayerMetal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ void close() {
return reinterpret_cast<jlong>(instance->fQueue);
}

extern "C" JNIEXPORT jlong JNICALL Java_io_github_humbleui_jwm_LayerMetal__1nGetMetalLayer
(JNIEnv* env, jobject obj) {
jwm::LayerMetal* instance = reinterpret_cast<jwm::LayerMetal*>(jwm::classes::Native::fromJava(env, obj));
return reinterpret_cast<jlong>(instance->fMetalLayer);
}

extern "C" JNIEXPORT jlong JNICALL Java_io_github_humbleui_jwm_LayerMetal__1nNextDrawableTexturePtr
(JNIEnv* env, jobject obj) {
jwm::LayerMetal* instance = reinterpret_cast<jwm::LayerMetal*>(jwm::classes::Native::fromJava(env, obj));
Expand Down
4 changes: 3 additions & 1 deletion macos/java/LayerMetal.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class LayerMetal extends RefCounted implements Layer {
@ApiStatus.Internal public Window _window;
@ApiStatus.Internal public int _width;
@ApiStatus.Internal public int _height;


public LayerMetal() {
super(_nMake());
Expand Down Expand Up @@ -82,8 +83,9 @@ public long nextDrawableTexturePtr() {
@ApiStatus.Internal public native void _nReconfigure();
@ApiStatus.Internal public native void _nResize(int width, int height);
@ApiStatus.Internal public native void _nSwapBuffers();
@ApiStatus.Internal public native long _nGetMetalLayer();
@ApiStatus.Internal public native long _nGetDevicePtr();
@ApiStatus.Internal public native long _nGetQueuePtr();
@ApiStatus.Internal public native long _nNextDrawableTexturePtr();
@ApiStatus.Internal public native void _nClose();
}
}

0 comments on commit 79ab287

Please sign in to comment.