Path: blob/master/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.h
41159 views
/*1* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef MTLRenderQueue_h_Included26#define MTLRenderQueue_h_Included2728#include "MTLContext.h"29#include "MTLSurfaceData.h"30#include "MTLVertexCache.h"3132/*33* The following macros are used to pick values (of the specified type) off34* the queue.35*/36#define NEXT_VAL(buf, type) (((type *)((buf) += sizeof(type)))[-1])37#define NEXT_BYTE(buf) NEXT_VAL(buf, unsigned char)38#define NEXT_INT(buf) NEXT_VAL(buf, jint)39#define NEXT_FLOAT(buf) NEXT_VAL(buf, jfloat)40#define NEXT_BOOLEAN(buf) (jboolean)NEXT_INT(buf)41#define NEXT_LONG(buf) NEXT_VAL(buf, jlong)42#define NEXT_DOUBLE(buf) NEXT_VAL(buf, jdouble)4344// Operations for CheckPreviousOp45enum {46MTL_OP_INIT,47MTL_OP_AA,48MTL_OP_SET_COLOR,49MTL_OP_RESET_PAINT,50MTL_OP_SYNC,51MTL_OP_SHAPE_CLIP_SPANS,52MTL_OP_MASK_OP,53MTL_OP_OTHER54};55/*56* These macros now simply delegate to the CheckPreviousOp() method.57*/58#define CHECK_PREVIOUS_OP(op) MTLRenderQueue_CheckPreviousOp(op)59#define RESET_PREVIOUS_OP() {mtlPreviousOp = MTL_OP_INIT;}6061/*62* Increments a pointer (buf) by the given number of bytes.63*/64#define SKIP_BYTES(buf, numbytes) buf += (numbytes)6566/*67* Extracts a value at the given offset from the provided packed value.68*/69#define EXTRACT_VAL(packedval, offset, mask) \70(((packedval) >> (offset)) & (mask))71#define EXTRACT_BYTE(packedval, offset) \72(unsigned char)EXTRACT_VAL(packedval, offset, 0xff)73#define EXTRACT_BOOLEAN(packedval, offset) \74(jboolean)EXTRACT_VAL(packedval, offset, 0x1)7576/*77* The following macros allow the caller to return (or continue) if the78* provided value is NULL. (The strange else clause is included below to79* allow for a trailing ';' after RETURN/CONTINUE_IF_NULL() invocations.)80*/81#define ACT_IF_NULL(ACTION, value) \82if ((value) == NULL) { \83J2dTraceLn1(J2D_TRACE_ERROR, \84"%s is null", #value); \85ACTION; \86} else do { } while (0)87#define RETURN_IF_NULL(value) ACT_IF_NULL(return, value)88#define CONTINUE_IF_NULL(value) ACT_IF_NULL(continue, value)8990#define ACT_IF_TRUE(ACTION, value) \91if ((value)) { \92J2dTraceLn1(J2D_TRACE_ERROR, \93"%s is false", #value);\94ACTION; \95} else do { } while (0)9697#define RETURN_IF_TRUE(value) ACT_IF_TRUE(return, value)9899MTLContext *MTLRenderQueue_GetCurrentContext();100BMTLSDOps *MTLRenderQueue_GetCurrentDestination();101void commitEncodedCommands();102103extern jint mtlPreviousOp;104105#endif /* MTLRenderQueue_h_Included */106107108