|
1 /* |
|
2 * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 #ifndef MetalLayer_h_Included |
|
27 #define MetalLayer_h_Included |
|
28 |
|
29 #import <JavaNativeFoundation/JavaNativeFoundation.h> |
|
30 #import <QuartzCore/CAMetalLayer.h> |
|
31 #import <Metal/Metal.h> |
|
32 |
|
33 |
|
34 @interface MetalLayer : CAMetalLayer |
|
35 { |
|
36 @private |
|
37 JNFWeakJObjectWrapper *javaLayer; |
|
38 |
|
39 // intermediate buffer, used the RQ lock to synchronize |
|
40 id<MTLTexture> mtlTexture; |
|
41 //GLenum target; |
|
42 float textureWidth; |
|
43 float textureHeight; |
|
44 #ifdef REMOTELAYER |
|
45 //CGLLayer *parentLayer; |
|
46 //CGLLayer *remoteLayer; |
|
47 //NSObject<JRSRemoteLayer> *jrsRemoteLayer; |
|
48 #endif /* REMOTELAYER */ |
|
49 } |
|
50 |
|
51 @property (nonatomic, retain) JNFWeakJObjectWrapper *javaLayer; |
|
52 @property (readwrite, assign) float textureWidth; |
|
53 @property (readwrite, assign) float textureHeight; |
|
54 @property (readwrite, assign) id<MTLTexture> mtlTexture; |
|
55 @property (readwrite, assign) id<MTLLibrary> mtlLibrary; |
|
56 @property (readwrite, assign) MTLRenderPipelineDescriptor* mtlRenderPipelineDescriptor; |
|
57 @property (readwrite, assign) id<MTLRenderPipelineState> renderPipelineState; |
|
58 //@property (readwrite, assign) id<MTLBuffer> LineVertexBuffer; |
|
59 //@property (readwrite, assign) id<MTLBuffer> QuadVertexBuffer; |
|
60 #ifdef REMOTELAYER |
|
61 //@property (nonatomic, retain) CGLLayer *parentLayer; |
|
62 //@property (nonatomic, retain) CGLLayer *remoteLayer; |
|
63 //@property (nonatomic, retain) NSObject<JRSRemoteLayer> *jrsRemoteLayer; |
|
64 #endif |
|
65 |
|
66 - (id) initWithJavaLayer:(JNFWeakJObjectWrapper *)javaLayer; |
|
67 - (void) blitTexture; |
|
68 @end |
|
69 |
|
70 |
|
71 // dummy for PoC purpose |
|
72 void MetalLayer_drawLine(float x1, float y1, float x2, float y2); |
|
73 void MetalLayer_setColor(int color); |
|
74 |
|
75 #endif /* MetalLayer_h_Included */ |