jdk/src/share/classes/sun/java2d/opengl/OGLContext.java
changeset 16734 da1901d79073
parent 12813 c10ab96dcf41
child 16739 018660b0c613
equal deleted inserted replaced
16733:9267ec7004a1 16734:da1901d79073
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    30 import sun.java2d.pipe.RenderQueue;
    30 import sun.java2d.pipe.RenderQueue;
    31 import sun.java2d.pipe.hw.ContextCapabilities;
    31 import sun.java2d.pipe.hw.ContextCapabilities;
    32 import static sun.java2d.pipe.BufferedOpCodes.*;
    32 import static sun.java2d.pipe.BufferedOpCodes.*;
    33 import static sun.java2d.pipe.hw.ContextCapabilities.*;
    33 import static sun.java2d.pipe.hw.ContextCapabilities.*;
    34 
    34 
    35 import javax.tools.annotation.GenerateNativeHeader;
    35 import java.lang.annotation.Native;
    36 
    36 
    37 /**
    37 /**
    38  * Note that the RenderQueue lock must be acquired before calling any of
    38  * Note that the RenderQueue lock must be acquired before calling any of
    39  * the methods in this class.
    39  * the methods in this class.
    40  */
    40  */
   153         rq.ensureCapacity(4);
   153         rq.ensureCapacity(4);
   154         buf.putInt(RESTORE_STATE);
   154         buf.putInt(RESTORE_STATE);
   155         rq.flushNow();
   155         rq.flushNow();
   156     }
   156     }
   157 
   157 
   158     /* No native methods here, but the constants are needed in the supporting JNI code */
       
   159     @GenerateNativeHeader
       
   160     static class OGLContextCaps extends ContextCapabilities {
   158     static class OGLContextCaps extends ContextCapabilities {
   161         /**
   159         /**
   162          * Indicates the presence of the GL_EXT_framebuffer_object extension.
   160          * Indicates the presence of the GL_EXT_framebuffer_object extension.
   163          * This cap will only be set if the fbobject system property has been
   161          * This cap will only be set if the fbobject system property has been
   164          * enabled and we are able to create an FBO with depth buffer.
   162          * enabled and we are able to create an FBO with depth buffer.
   165          */
   163          */
   166         static final int CAPS_EXT_FBOBJECT     =
   164     @Native static final int CAPS_EXT_FBOBJECT     =
   167                 (CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE);
   165                 (CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE);
   168         /** Indicates that the context supports a stored alpha channel. */
   166         /** Indicates that the context supports a stored alpha channel. */
   169         static final int CAPS_STORED_ALPHA     = CAPS_RT_PLAIN_ALPHA;
   167     @Native static final int CAPS_STORED_ALPHA     = CAPS_RT_PLAIN_ALPHA;
   170         /** Indicates that the context is doublebuffered. */
   168         /** Indicates that the context is doublebuffered. */
   171         static final int CAPS_DOUBLEBUFFERED   = (FIRST_PRIVATE_CAP << 0);
   169     @Native static final int CAPS_DOUBLEBUFFERED   = (FIRST_PRIVATE_CAP << 0);
   172         /**
   170         /**
   173          * Indicates the presence of the GL_ARB_fragment_shader extension.
   171          * Indicates the presence of the GL_ARB_fragment_shader extension.
   174          * This cap will only be set if the lcdshader system property has been
   172          * This cap will only be set if the lcdshader system property has been
   175          * enabled and the hardware supports the minimum number of texture units
   173          * enabled and the hardware supports the minimum number of texture units
   176          */
   174          */
   177         static final int CAPS_EXT_LCD_SHADER   = (FIRST_PRIVATE_CAP << 1);
   175     @Native static final int CAPS_EXT_LCD_SHADER   = (FIRST_PRIVATE_CAP << 1);
   178         /**
   176         /**
   179          * Indicates the presence of the GL_ARB_fragment_shader extension.
   177          * Indicates the presence of the GL_ARB_fragment_shader extension.
   180          * This cap will only be set if the biopshader system property has been
   178          * This cap will only be set if the biopshader system property has been
   181          * enabled and the hardware meets our minimum requirements.
   179          * enabled and the hardware meets our minimum requirements.
   182          */
   180          */
   183         static final int CAPS_EXT_BIOP_SHADER  = (FIRST_PRIVATE_CAP << 2);
   181     @Native static final int CAPS_EXT_BIOP_SHADER  = (FIRST_PRIVATE_CAP << 2);
   184         /**
   182         /**
   185          * Indicates the presence of the GL_ARB_fragment_shader extension.
   183          * Indicates the presence of the GL_ARB_fragment_shader extension.
   186          * This cap will only be set if the gradshader system property has been
   184          * This cap will only be set if the gradshader system property has been
   187          * enabled and the hardware meets our minimum requirements.
   185          * enabled and the hardware meets our minimum requirements.
   188          */
   186          */
   189         static final int CAPS_EXT_GRAD_SHADER  = (FIRST_PRIVATE_CAP << 3);
   187     @Native static final int CAPS_EXT_GRAD_SHADER  = (FIRST_PRIVATE_CAP << 3);
   190         /** Indicates the presence of the GL_ARB_texture_rectangle extension. */
   188         /** Indicates the presence of the GL_ARB_texture_rectangle extension. */
   191         static final int CAPS_EXT_TEXRECT      = (FIRST_PRIVATE_CAP << 4);
   189     @Native static final int CAPS_EXT_TEXRECT      = (FIRST_PRIVATE_CAP << 4);
   192 
   190 
   193         OGLContextCaps(int caps, String adapterId) {
   191         OGLContextCaps(int caps, String adapterId) {
   194             super(caps, adapterId);
   192             super(caps, adapterId);
   195         }
   193         }
   196 
   194