Path: blob/master/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceDataBase.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 MTLSurfaceDataBase_h_Included26#define MTLSurfaceDataBase_h_Included2728#include "java_awt_image_AffineTransformOp.h"29#include "sun_java2d_pipe_hw_AccelSurface.h"3031#include "SurfaceData.h"32#include "Trace.h"3334/**35* The MTLSDOps structure describes a native Metal surface and contains all36* information pertaining to the native surface. Some information about37* the more important/different fields:38*39* void* privOps;40* Pointer to native-specific (Metal) SurfaceData info, such as the41* native Drawable handle and GraphicsConfig data.42*43* jint drawableType;44* The surface type; can be any one of the surface type constants defined45* below (MTLSD_WINDOW, MTLSD_TEXTURE, etc).46*47* jboolean isOpaque;48* If true, the surface should be treated as being fully opaque. If49* the underlying surface (e.g. MTLTexture/MTLBuffer) has an alpha channel and50* isOpaque is true, then we should take appropriate action to ensure that the51* surface remains fully opaque.52*53* jint width/height;54* The cached surface bounds. For offscreen surface types (55* MTLSD_TEXTURE, MTLSD_RT_TEXTURE etc.) these values must remain constant.56* Onscreen window surfaces (MTLSD_WINDOW, MTLSD_FLIP_BACKBUFFER, etc.) may57* have their bounds changed in response to a programmatic or user-initiated58* event, so these values represent the last known dimensions. To determine the59* true current bounds of this surface, query the native Drawable through the60* privOps field.61*62* void* pTexture;63* The texture object handle, as generated by MTLTextureDescriptor(). If this64* value is null, the texture has not yet been initialized.65*66* void* pStencilTexture;67* The byte buffer stencil mask used in rendering Metal rendering pass.68*/69typedef struct {70SurfaceDataOps sdOps;71void* privOps;72jobject graphicsConfig;73jint drawableType;74jboolean isOpaque;75jint width;76jint height;77void* pTexture;78void* pStencilData; // stencil data to be rendered to this buffer79void* pStencilTexture; // stencil texture byte buffer stencil mask used in main rendering80} BMTLSDOps;8182#define MTLSD_UNDEFINED sun_java2d_pipe_hw_AccelSurface_UNDEFINED83#define MTLSD_WINDOW sun_java2d_pipe_hw_AccelSurface_WINDOW84#define MTLSD_TEXTURE sun_java2d_pipe_hw_AccelSurface_TEXTURE85#define MTLSD_FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER86#define MTLSD_RT_TEXTURE sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE8788/**89* These are shorthand names for the filtering method constants used by90* image transform methods.91*/92#define MTLSD_XFORM_DEFAULT 093#define MTLSD_XFORM_NEAREST_NEIGHBOR \94java_awt_image_AffineTransformOp_TYPE_NEAREST_NEIGHBOR95#define MTLSD_XFORM_BILINEAR \96java_awt_image_AffineTransformOp_TYPE_BILINEAR9798/**99* The SurfaceRasterFlags structure contains information about raster (of some MTLTexture):100*101* jboolean isOpaque;102* If true, indicates that this pixel format hasn't alpha component (and values of this component can contain garbage).103*104* jboolean isPremultiplied;105* If true, indicates that this pixel format contains color components that have been pre-multiplied by their106* corresponding alpha component.107*/108typedef struct {109jboolean isOpaque;110jboolean isPremultiplied;111} SurfaceRasterFlags;112113/**114* Exported methods.115*/116jint MTLSD_Lock(JNIEnv *env,117SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo,118jint lockflags);119void MTLSD_GetRasInfo(JNIEnv *env,120SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo);121void MTLSD_Unlock(JNIEnv *env,122SurfaceDataOps *ops, SurfaceDataRasInfo *pRasInfo);123void MTLSD_Dispose(JNIEnv *env, SurfaceDataOps *ops);124void MTLSD_Delete(JNIEnv *env, BMTLSDOps *mtlsdo);125jint MTLSD_NextPowerOfTwo(jint val, jint max);126127#endif /* MTLSurfaceDataBase_h_Included */128129130