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