1 /* |
1 /* |
2 * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2007, 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 |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package sun.java2d.d3d; |
26 package sun.java2d.d3d; |
27 |
27 |
28 import javax.tools.annotation.GenerateNativeHeader; |
28 import java.lang.annotation.Native; |
29 import sun.java2d.pipe.BufferedContext; |
29 import sun.java2d.pipe.BufferedContext; |
30 import sun.java2d.pipe.RenderBuffer; |
30 import sun.java2d.pipe.RenderBuffer; |
31 import sun.java2d.pipe.RenderQueue; |
31 import sun.java2d.pipe.RenderQueue; |
32 import sun.java2d.pipe.hw.ContextCapabilities; |
32 import sun.java2d.pipe.hw.ContextCapabilities; |
33 import static sun.java2d.pipe.BufferedOpCodes.*; |
33 import static sun.java2d.pipe.BufferedOpCodes.*; |
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 */ |
41 /* No native methods here, but the constants are needed in the supporting JNI code */ |
|
42 @GenerateNativeHeader |
|
43 class D3DContext extends BufferedContext { |
41 class D3DContext extends BufferedContext { |
44 |
42 |
45 private final D3DGraphicsDevice device; |
43 private final D3DGraphicsDevice device; |
46 |
44 |
47 D3DContext(RenderQueue rq, D3DGraphicsDevice device) { |
45 D3DContext(RenderQueue rq, D3DGraphicsDevice device) { |
141 |
139 |
142 D3DGraphicsDevice getDevice() { |
140 D3DGraphicsDevice getDevice() { |
143 return device; |
141 return device; |
144 } |
142 } |
145 |
143 |
146 /* No native methods here, but the constants are needed in the supporting JNI code */ |
|
147 @GenerateNativeHeader |
|
148 static class D3DContextCaps extends ContextCapabilities { |
144 static class D3DContextCaps extends ContextCapabilities { |
149 /** |
145 /** |
150 * Indicates the presence of pixel shaders (v2.0 or greater). |
146 * Indicates the presence of pixel shaders (v2.0 or greater). |
151 * This cap will only be set if the hardware supports the minimum number |
147 * This cap will only be set if the hardware supports the minimum number |
152 * of texture units. |
148 * of texture units. |
153 */ |
149 */ |
154 static final int CAPS_LCD_SHADER = (FIRST_PRIVATE_CAP << 0); |
150 @Native static final int CAPS_LCD_SHADER = (FIRST_PRIVATE_CAP << 0); |
155 /** |
151 /** |
156 * Indicates the presence of pixel shaders (v2.0 or greater). |
152 * Indicates the presence of pixel shaders (v2.0 or greater). |
157 * This cap will only be set if the hardware meets our |
153 * This cap will only be set if the hardware meets our |
158 * minimum requirements. |
154 * minimum requirements. |
159 */ |
155 */ |
160 static final int CAPS_BIOP_SHADER = (FIRST_PRIVATE_CAP << 1); |
156 @Native static final int CAPS_BIOP_SHADER = (FIRST_PRIVATE_CAP << 1); |
161 /** |
157 /** |
162 * Indicates that the device was successfully initialized and can |
158 * Indicates that the device was successfully initialized and can |
163 * be safely used. |
159 * be safely used. |
164 */ |
160 */ |
165 static final int CAPS_DEVICE_OK = (FIRST_PRIVATE_CAP << 2); |
161 @Native static final int CAPS_DEVICE_OK = (FIRST_PRIVATE_CAP << 2); |
166 /** |
162 /** |
167 * Indicates that the device has all of the necessary capabilities |
163 * Indicates that the device has all of the necessary capabilities |
168 * to support the Antialiasing Pixel Shader program. |
164 * to support the Antialiasing Pixel Shader program. |
169 */ |
165 */ |
170 static final int CAPS_AA_SHADER = (FIRST_PRIVATE_CAP << 3); |
166 @Native static final int CAPS_AA_SHADER = (FIRST_PRIVATE_CAP << 3); |
171 |
167 |
172 D3DContextCaps(int caps, String adapterId) { |
168 D3DContextCaps(int caps, String adapterId) { |
173 super(caps, adapterId); |
169 super(caps, adapterId); |
174 } |
170 } |
175 |
171 |