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/MTLRenderQueue.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 MTLRenderQueue_h_Included
27
#define MTLRenderQueue_h_Included
28
29
#include "MTLContext.h"
30
#include "MTLSurfaceData.h"
31
#include "MTLVertexCache.h"
32
33
/*
34
* The following macros are used to pick values (of the specified type) off
35
* the queue.
36
*/
37
#define NEXT_VAL(buf, type) (((type *)((buf) += sizeof(type)))[-1])
38
#define NEXT_BYTE(buf) NEXT_VAL(buf, unsigned char)
39
#define NEXT_INT(buf) NEXT_VAL(buf, jint)
40
#define NEXT_FLOAT(buf) NEXT_VAL(buf, jfloat)
41
#define NEXT_BOOLEAN(buf) (jboolean)NEXT_INT(buf)
42
#define NEXT_LONG(buf) NEXT_VAL(buf, jlong)
43
#define NEXT_DOUBLE(buf) NEXT_VAL(buf, jdouble)
44
45
// Operations for CheckPreviousOp
46
enum {
47
MTL_OP_INIT,
48
MTL_OP_AA,
49
MTL_OP_SET_COLOR,
50
MTL_OP_RESET_PAINT,
51
MTL_OP_SYNC,
52
MTL_OP_SHAPE_CLIP_SPANS,
53
MTL_OP_MASK_OP,
54
MTL_OP_OTHER
55
};
56
/*
57
* These macros now simply delegate to the CheckPreviousOp() method.
58
*/
59
#define CHECK_PREVIOUS_OP(op) MTLRenderQueue_CheckPreviousOp(op)
60
#define RESET_PREVIOUS_OP() {mtlPreviousOp = MTL_OP_INIT;}
61
62
/*
63
* Increments a pointer (buf) by the given number of bytes.
64
*/
65
#define SKIP_BYTES(buf, numbytes) buf += (numbytes)
66
67
/*
68
* Extracts a value at the given offset from the provided packed value.
69
*/
70
#define EXTRACT_VAL(packedval, offset, mask) \
71
(((packedval) >> (offset)) & (mask))
72
#define EXTRACT_BYTE(packedval, offset) \
73
(unsigned char)EXTRACT_VAL(packedval, offset, 0xff)
74
#define EXTRACT_BOOLEAN(packedval, offset) \
75
(jboolean)EXTRACT_VAL(packedval, offset, 0x1)
76
77
/*
78
* The following macros allow the caller to return (or continue) if the
79
* provided value is NULL. (The strange else clause is included below to
80
* allow for a trailing ';' after RETURN/CONTINUE_IF_NULL() invocations.)
81
*/
82
#define ACT_IF_NULL(ACTION, value) \
83
if ((value) == NULL) { \
84
J2dTraceLn1(J2D_TRACE_ERROR, \
85
"%s is null", #value); \
86
ACTION; \
87
} else do { } while (0)
88
#define RETURN_IF_NULL(value) ACT_IF_NULL(return, value)
89
#define CONTINUE_IF_NULL(value) ACT_IF_NULL(continue, value)
90
91
#define ACT_IF_TRUE(ACTION, value) \
92
if ((value)) { \
93
J2dTraceLn1(J2D_TRACE_ERROR, \
94
"%s is false", #value);\
95
ACTION; \
96
} else do { } while (0)
97
98
#define RETURN_IF_TRUE(value) ACT_IF_TRUE(return, value)
99
100
MTLContext *MTLRenderQueue_GetCurrentContext();
101
BMTLSDOps *MTLRenderQueue_GetCurrentDestination();
102
void commitEncodedCommands();
103
104
extern jint mtlPreviousOp;
105
106
#endif /* MTLRenderQueue_h_Included */
107
108