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 MetalRenderQueue_h_Included
  27 #define MetalRenderQueue_h_Included
  28 
  29 //#include "MetalContext.h"
  30 #include "MetalSurfaceData.h"
  31 
  32 MetalSDOps *MetalRenderQueue_GetCurrentDestination();
  33 
  34 /*
  35  * The following macros are used to pick values (of the specified type) off
  36  * the queue.
  37  */
  38 #define NEXT_VAL(buf, type) (((type *)((buf) += sizeof(type)))[-1])
  39 #define NEXT_BYTE(buf)      NEXT_VAL(buf, unsigned char)
  40 #define NEXT_INT(buf)       NEXT_VAL(buf, jint)
  41 #define NEXT_FLOAT(buf)     NEXT_VAL(buf, jfloat)
  42 #define NEXT_BOOLEAN(buf)   (jboolean)NEXT_INT(buf)
  43 #define NEXT_LONG(buf)      NEXT_VAL(buf, jlong)
  44 #define NEXT_DOUBLE(buf)    NEXT_VAL(buf, jdouble)
  45 
  46 /*
  47  * Increments a pointer (buf) by the given number of bytes.
  48  */
  49 #define SKIP_BYTES(buf, numbytes) buf += (numbytes)
  50 
  51 /*
  52  * Extracts a value at the given offset from the provided packed value.
  53  */
  54 #define EXTRACT_VAL(packedval, offset, mask) \
  55     (((packedval) >> (offset)) & (mask))
  56 #define EXTRACT_BYTE(packedval, offset) \
  57     (unsigned char)EXTRACT_VAL(packedval, offset, 0xff)
  58 #define EXTRACT_BOOLEAN(packedval, offset) \
  59     (jboolean)EXTRACT_VAL(packedval, offset, 0x1)
  60 
  61 #endif /*MetalRenderQueue_h_Included*/