Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.h
41159 views
1
/*
2
* Copyright (c) 2019, 2021, 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 EncoderManager_h_Included
27
#define EncoderManager_h_Included
28
29
#import <Metal/Metal.h>
30
31
#include "RenderOptions.h"
32
33
@class MTLContex;
34
35
/**
36
* The EncoderManager class used to obtain MTLRenderCommandEncoder (or MTLBlitCommandEncoder) corresponding
37
* to the current state of MTLContext.
38
*
39
* Due to performance issues (creation of MTLRenderCommandEncoder isn't cheap), each getXXXEncoder invocation
40
* updates properties of common (cached) encoder and returns this encoder.
41
*
42
* Base method getEncoder does the following:
43
* 1. Checks whether common encoder must be closed and recreated (some of encoder properties is 'persistent',
44
* for example destination, stencil, or any other property of MTLRenderPassDescriptor)
45
* 2. Updates 'mutable' properties encoder: pipelineState (with corresponding buffers), clip, transform, e.t.c. To avoid
46
* unnecessary calls of [encoder setXXX] this manager compares requested state with cached one.
47
*/
48
@interface EncoderManager : NSObject
49
- (id _Nonnull)init;
50
- (void)dealloc;
51
52
- (void)setContext:(MTLContex * _Nonnull)mtlc;
53
54
// returns encoder that renders/fills geometry with current paint and composite
55
- (id<MTLRenderCommandEncoder> _Nonnull)getRenderEncoder:(const BMTLSDOps * _Nonnull)dstOps;
56
57
- (id<MTLRenderCommandEncoder> _Nonnull)getAARenderEncoder:(const BMTLSDOps * _Nonnull)dstOps;
58
59
- (id<MTLRenderCommandEncoder> _Nonnull)getRenderEncoder:(id<MTLTexture> _Nonnull)dest
60
isDstOpaque:(bool)isOpaque;
61
62
- (id<MTLRenderCommandEncoder> _Nonnull)getAAShaderRenderEncoder:(const BMTLSDOps * _Nonnull)dstOps;
63
64
// returns encoder that renders/fills geometry with current composite and with given texture
65
// (user must call [encoder setFragmentTexture] before any rendering)
66
- (id<MTLRenderCommandEncoder> _Nonnull)getTextureEncoder:(const BMTLSDOps * _Nonnull)dstOps
67
isSrcOpaque:(bool)isSrcOpaque;
68
69
- (id<MTLRenderCommandEncoder> _Nonnull) getTextureEncoder:(id<MTLTexture> _Nonnull)dest
70
isSrcOpaque:(bool)isSrcOpaque
71
isDstOpaque:(bool)isDstOpaque;
72
73
- (id<MTLRenderCommandEncoder> _Nonnull) getLCDEncoder:(id<MTLTexture> _Nonnull)dest
74
isSrcOpaque:(bool)isSrcOpaque
75
isDstOpaque:(bool)isDstOpaque;
76
77
- (id<MTLRenderCommandEncoder> _Nonnull)getTextureEncoder:(id<MTLTexture> _Nonnull)dest
78
isSrcOpaque:(bool)isSrcOpaque
79
isDstOpaque:(bool)isDstOpaque
80
interpolation:(int)interpolation;
81
82
- (id<MTLRenderCommandEncoder> _Nonnull)getTextureEncoder:(id<MTLTexture> _Nonnull)dest
83
isSrcOpaque:(bool)isSrcOpaque
84
isDstOpaque:(bool)isDstOpaque
85
interpolation:(int)interpolation
86
isAA:(jboolean)isAA;
87
88
- (id<MTLRenderCommandEncoder> _Nonnull)getTextEncoder:(const BMTLSDOps * _Nonnull)dstOps
89
isSrcOpaque:(bool)isSrcOpaque;
90
91
// Base method to obtain any MTLRenderCommandEncoder
92
- (id<MTLRenderCommandEncoder> _Nonnull) getEncoder:(id<MTLTexture> _Nonnull)dest
93
isDestOpaque:(jboolean)isDestOpaque
94
renderOptions:(const RenderOptions * _Nonnull)renderOptions;
95
96
- (id<MTLBlitCommandEncoder> _Nonnull)createBlitEncoder;
97
98
- (void)endEncoder;
99
@end
100
101
#endif // EncoderManager_h_Included
102
103