Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/macosx/native_NOTIOS/sun/java2d/opengl/CGLGraphicsConfig.h
38829 views
/*1* Copyright (c) 2011, 2012, 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 CGLGraphicsConfig_h_Included26#define CGLGraphicsConfig_h_Included2728#import "jni.h"29#import "J2D_GL/gl.h"30#import "OGLSurfaceData.h"31#import "OGLContext.h"32#import <Cocoa/Cocoa.h>3334@interface GraphicsConfigUtil : NSObject {}35+ (void) _getCGLConfigInfo: (NSMutableArray *)argValue;36@end3738// REMIND: Using an NSOpenGLPixelBuffer as the scratch surface has been39// problematic thus far (seeing garbage and flickering when switching40// between an NSView and the scratch surface), so the following enables41// an alternate codepath that uses a hidden NSWindow/NSView as the scratch42// surface, for the purposes of making a context current in certain43// situations. It appears that calling [NSOpenGLContext setView] too44// frequently contributes to the bad behavior, so we should try to avoid45// switching to the scratch surface whenever possible.4647/* Do we need this if we are using all off-screen drawing ? */48#define USE_NSVIEW_FOR_SCRATCH 14950/* Uncomment to have an additional CAOGLLayer instance tied to51* each instance, which can be used to test remoting the layer52* to an out of process window. The additional layer is needed53* because a layer can only be attached to one context (view/window).54* This is only for testing purposes and can be removed if/when no55* longer needed.56*/57//#define REMOTELAYER 15859#ifdef REMOTELAYER60#import <JavaRuntimeSupport/JRSRemoteLayer.h>61#import <pthread.h>62#include <unistd.h>63#include <stdio.h>64#import <sys/socket.h>65#import <sys/un.h>6667extern mach_port_t JRSRemotePort;68extern int remoteSocketFD;69extern void sendLayerID(int layerID);7071#endif /* REMOTELAYER */727374/**75* The CGLGraphicsConfigInfo structure contains information specific to a76* given CGLGraphicsConfig (pixel format).77*78* jint screen;79* The screen and PixelFormat for the associated CGLGraphicsConfig.80*81* NSOpenGLPixelFormat *pixfmt;82* The pixel format of the native NSOpenGL context.83*84* OGLContext *context;85* The context associated with this CGLGraphicsConfig.86*/87typedef struct _CGLGraphicsConfigInfo {88jint screen;89NSOpenGLPixelFormat *pixfmt;90OGLContext *context;91} CGLGraphicsConfigInfo;9293/**94* The CGLCtxInfo structure contains the native CGLContext information95* required by and is encapsulated by the platform-independent OGLContext96* structure.97*98* NSOpenGLContext *context;99* The core native NSOpenGL context. Rendering commands have no effect until100* a context is made current (active).101*102* NSOpenGLPixelBuffer *scratchSurface;103* The scratch surface id used to make a context current when we do104* not otherwise have a reference to an OpenGL surface for the purposes of105* making a context current.106*/107typedef struct _CGLCtxInfo {108NSOpenGLContext *context;109#if USE_NSVIEW_FOR_SCRATCH110NSView *scratchSurface;111#else112NSOpenGLPixelBuffer *scratchSurface;113#endif114} CGLCtxInfo;115116#endif /* CGLGraphicsConfig_h_Included */117118119