OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "GrGLCaps.h" | 9 #include "GrGLCaps.h" |
10 #include "GrGLContext.h" | 10 #include "GrGLContext.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return *this; | 88 return *this; |
89 } | 89 } |
90 | 90 |
91 void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { | 91 void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
92 | 92 |
93 this->reset(); | 93 this->reset(); |
94 if (!ctxInfo.isInitialized()) { | 94 if (!ctxInfo.isInitialized()) { |
95 return; | 95 return; |
96 } | 96 } |
97 | 97 |
98 GrGLBinding binding = ctxInfo.binding(); | 98 GrGLStandard standard = ctxInfo.standard(); |
99 GrGLVersion version = ctxInfo.version(); | 99 GrGLVersion version = ctxInfo.version(); |
100 | 100 |
101 /************************************************************************** | 101 /************************************************************************** |
102 * Caps specific to GrGLCaps | 102 * Caps specific to GrGLCaps |
103 **************************************************************************/ | 103 **************************************************************************/ |
104 | 104 |
105 if (kES_GrGLBinding == binding) { | 105 if (kGLES_GrGLStandard == standard) { |
106 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS, | 106 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS, |
107 &fMaxFragmentUniformVectors); | 107 &fMaxFragmentUniformVectors); |
108 } else { | 108 } else { |
109 SkASSERT(kDesktop_GrGLBinding == binding); | 109 SkASSERT(kGL_GrGLStandard == standard); |
110 GrGLint max; | 110 GrGLint max; |
111 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); | 111 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); |
112 fMaxFragmentUniformVectors = max / 4; | 112 fMaxFragmentUniformVectors = max / 4; |
113 if (version >= GR_GL_VER(3, 2)) { | 113 if (version >= GR_GL_VER(3, 2)) { |
114 GrGLint profileMask; | 114 GrGLint profileMask; |
115 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); | 115 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); |
116 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); | 116 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); |
117 } | 117 } |
118 if (!fIsCoreProfile) { | 118 if (!fIsCoreProfile) { |
119 fFixedFunctionSupport = true; | 119 fFixedFunctionSupport = true; |
120 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionT
extureCoords); | 120 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionT
extureCoords); |
121 // Sanity check | 121 // Sanity check |
122 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionText
ureCoords < 128); | 122 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionText
ureCoords < 128); |
123 } | 123 } |
124 } | 124 } |
125 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); | 125 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); |
126 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); | 126 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); |
127 | 127 |
128 if (kDesktop_GrGLBinding == binding) { | 128 if (kGL_GrGLStandard == standard) { |
129 fRGBA8RenderbufferSupport = true; | 129 fRGBA8RenderbufferSupport = true; |
130 } else { | 130 } else { |
131 fRGBA8RenderbufferSupport = version >= GR_GL_VER(3,0) || | 131 fRGBA8RenderbufferSupport = version >= GR_GL_VER(3,0) || |
132 ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || | 132 ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || |
133 ctxInfo.hasExtension("GL_ARM_rgba8"); | 133 ctxInfo.hasExtension("GL_ARM_rgba8"); |
134 } | 134 } |
135 | 135 |
136 if (kDesktop_GrGLBinding == binding) { | 136 if (kGL_GrGLStandard == standard) { |
137 fBGRAFormatSupport = version >= GR_GL_VER(1,2) || | 137 fBGRAFormatSupport = version >= GR_GL_VER(1,2) || |
138 ctxInfo.hasExtension("GL_EXT_bgra"); | 138 ctxInfo.hasExtension("GL_EXT_bgra"); |
139 } else { | 139 } else { |
140 if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) { | 140 if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) { |
141 fBGRAFormatSupport = true; | 141 fBGRAFormatSupport = true; |
142 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { | 142 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { |
143 fBGRAFormatSupport = true; | 143 fBGRAFormatSupport = true; |
144 fBGRAIsInternalFormat = true; | 144 fBGRAIsInternalFormat = true; |
145 } | 145 } |
146 SkASSERT(fBGRAFormatSupport || | 146 SkASSERT(fBGRAFormatSupport || |
147 kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig); | 147 kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig); |
148 } | 148 } |
149 | 149 |
150 if (kDesktop_GrGLBinding == binding) { | 150 if (kGL_GrGLStandard == standard) { |
151 fTextureSwizzleSupport = version >= GR_GL_VER(3,3) || | 151 fTextureSwizzleSupport = version >= GR_GL_VER(3,3) || |
152 ctxInfo.hasExtension("GL_ARB_texture_swizzle"); | 152 ctxInfo.hasExtension("GL_ARB_texture_swizzle"); |
153 } else { | 153 } else { |
154 fTextureSwizzleSupport = version >= GR_GL_VER(3,0); | 154 fTextureSwizzleSupport = version >= GR_GL_VER(3,0); |
155 } | 155 } |
156 | 156 |
157 if (kDesktop_GrGLBinding == binding) { | 157 if (kGL_GrGLStandard == standard) { |
158 fUnpackRowLengthSupport = true; | 158 fUnpackRowLengthSupport = true; |
159 fUnpackFlipYSupport = false; | 159 fUnpackFlipYSupport = false; |
160 fPackRowLengthSupport = true; | 160 fPackRowLengthSupport = true; |
161 fPackFlipYSupport = false; | 161 fPackFlipYSupport = false; |
162 } else { | 162 } else { |
163 fUnpackRowLengthSupport = version >= GR_GL_VER(3,0) || | 163 fUnpackRowLengthSupport = version >= GR_GL_VER(3,0) || |
164 ctxInfo.hasExtension("GL_EXT_unpack_subimage")
; | 164 ctxInfo.hasExtension("GL_EXT_unpack_subimage")
; |
165 fUnpackFlipYSupport = ctxInfo.hasExtension("GL_CHROMIUM_flipy"); | 165 fUnpackFlipYSupport = ctxInfo.hasExtension("GL_CHROMIUM_flipy"); |
166 fPackRowLengthSupport = version >= GR_GL_VER(3,0) || | 166 fPackRowLengthSupport = version >= GR_GL_VER(3,0) || |
167 ctxInfo.hasExtension("GL_NV_pack_subimage"); | 167 ctxInfo.hasExtension("GL_NV_pack_subimage"); |
168 fPackFlipYSupport = | 168 fPackFlipYSupport = |
169 ctxInfo.hasExtension("GL_ANGLE_pack_reverse_row_order"); | 169 ctxInfo.hasExtension("GL_ANGLE_pack_reverse_row_order"); |
170 } | 170 } |
171 | 171 |
172 fTextureUsageSupport = (kES_GrGLBinding == binding) && | 172 fTextureUsageSupport = (kGLES_GrGLStandard == standard) && |
173 ctxInfo.hasExtension("GL_ANGLE_texture_usage"); | 173 ctxInfo.hasExtension("GL_ANGLE_texture_usage"); |
174 | 174 |
175 if (kDesktop_GrGLBinding == binding) { | 175 if (kGL_GrGLStandard == standard) { |
176 // The EXT version can apply to either GL or GLES. | 176 // The EXT version can apply to either GL or GLES. |
177 fTexStorageSupport = version >= GR_GL_VER(4,2) || | 177 fTexStorageSupport = version >= GR_GL_VER(4,2) || |
178 ctxInfo.hasExtension("GL_ARB_texture_storage") || | 178 ctxInfo.hasExtension("GL_ARB_texture_storage") || |
179 ctxInfo.hasExtension("GL_EXT_texture_storage"); | 179 ctxInfo.hasExtension("GL_EXT_texture_storage"); |
180 } else { | 180 } else { |
181 // Qualcomm Adreno drivers appear to have issues with texture storage. | 181 // Qualcomm Adreno drivers appear to have issues with texture storage. |
182 fTexStorageSupport = (version >= GR_GL_VER(3,0) && | 182 fTexStorageSupport = (version >= GR_GL_VER(3,0) && |
183 kQualcomm_GrGLVendor != ctxInfo.vendor()) || | 183 kQualcomm_GrGLVendor != ctxInfo.vendor()) || |
184 ctxInfo.hasExtension("GL_EXT_texture_storage"); | 184 ctxInfo.hasExtension("GL_EXT_texture_storage"); |
185 } | 185 } |
186 | 186 |
187 // ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support it if | 187 // ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support it if |
188 // it doesn't have ARB_texture_rg extension. | 188 // it doesn't have ARB_texture_rg extension. |
189 if (kDesktop_GrGLBinding == binding) { | 189 if (kGL_GrGLStandard == standard) { |
190 if (ctxInfo.isMesa()) { | 190 if (ctxInfo.isMesa()) { |
191 fTextureRedSupport = ctxInfo.hasExtension("GL_ARB_texture_rg"); | 191 fTextureRedSupport = ctxInfo.hasExtension("GL_ARB_texture_rg"); |
192 } else { | 192 } else { |
193 fTextureRedSupport = version >= GR_GL_VER(3,0) || | 193 fTextureRedSupport = version >= GR_GL_VER(3,0) || |
194 ctxInfo.hasExtension("GL_ARB_texture_rg"); | 194 ctxInfo.hasExtension("GL_ARB_texture_rg"); |
195 } | 195 } |
196 } else { | 196 } else { |
197 fTextureRedSupport = version >= GR_GL_VER(3,0) || | 197 fTextureRedSupport = version >= GR_GL_VER(3,0) || |
198 ctxInfo.hasExtension("GL_EXT_texture_rg"); | 198 ctxInfo.hasExtension("GL_EXT_texture_rg"); |
199 } | 199 } |
200 | 200 |
201 fImagingSupport = kDesktop_GrGLBinding == binding && | 201 fImagingSupport = kGL_GrGLStandard == standard && |
202 ctxInfo.hasExtension("GL_ARB_imaging"); | 202 ctxInfo.hasExtension("GL_ARB_imaging"); |
203 | 203 |
204 // ES 2 only guarantees RGBA/uchar + one other format/type combo for | 204 // ES 2 only guarantees RGBA/uchar + one other format/type combo for |
205 // ReadPixels. The other format has to checked at run-time since it | 205 // ReadPixels. The other format has to checked at run-time since it |
206 // can change based on which render target is bound | 206 // can change based on which render target is bound |
207 fTwoFormatLimit = kES_GrGLBinding == binding; | 207 fTwoFormatLimit = kGLES_GrGLStandard == standard; |
208 | 208 |
209 // Known issue on at least some Intel platforms: | 209 // Known issue on at least some Intel platforms: |
210 // http://code.google.com/p/skia/issues/detail?id=946 | 210 // http://code.google.com/p/skia/issues/detail?id=946 |
211 if (kIntel_GrGLVendor != ctxInfo.vendor()) { | 211 if (kIntel_GrGLVendor != ctxInfo.vendor()) { |
212 fFragCoordsConventionSupport = ctxInfo.glslGeneration() >= k150_GrGLSLGe
neration || | 212 fFragCoordsConventionSupport = ctxInfo.glslGeneration() >= k150_GrGLSLGe
neration || |
213 ctxInfo.hasExtension("GL_ARB_fragment_coo
rd_conventions"); | 213 ctxInfo.hasExtension("GL_ARB_fragment_coo
rd_conventions"); |
214 } | 214 } |
215 | 215 |
216 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha
ve trouble with | 216 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha
ve trouble with |
217 // frequently changing VBOs. We've measured a performance increase using non
-VBO vertex | 217 // frequently changing VBOs. We've measured a performance increase using non
-VBO vertex |
218 // data for dynamic content on these GPUs. Perhaps we should read the render
er string and | 218 // data for dynamic content on these GPUs. Perhaps we should read the render
er string and |
219 // limit this decision to specific GPU families rather than basing it on the
vendor alone. | 219 // limit this decision to specific GPU families rather than basing it on the
vendor alone. |
220 if (!GR_GL_MUST_USE_VBO && | 220 if (!GR_GL_MUST_USE_VBO && |
221 (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxIn
fo.vendor())) { | 221 (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxIn
fo.vendor())) { |
222 fUseNonVBOVertexAndIndexDynamicData = true; | 222 fUseNonVBOVertexAndIndexDynamicData = true; |
223 } | 223 } |
224 | 224 |
225 fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer"); | 225 fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer"); |
226 | 226 |
227 if (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInf
o.vendor()) { | 227 if (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInf
o.vendor()) { |
228 fFullClearIsFree = true; | 228 fFullClearIsFree = true; |
229 } | 229 } |
230 | 230 |
231 if (kDesktop_GrGLBinding == binding) { | 231 if (kGL_GrGLStandard == standard) { |
232 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || | 232 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
233 ctxInfo.hasExtension("GL_ARB_vertex_array_ob
ject"); | 233 ctxInfo.hasExtension("GL_ARB_vertex_array_ob
ject"); |
234 } else { | 234 } else { |
235 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || | 235 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
236 ctxInfo.hasExtension("GL_OES_vertex_array_ob
ject"); | 236 ctxInfo.hasExtension("GL_OES_vertex_array_ob
ject"); |
237 } | 237 } |
238 | 238 |
239 if (kES_GrGLBinding == binding) { | 239 if (kGLES_GrGLStandard == standard) { |
240 if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { | 240 if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { |
241 fFBFetchType = kEXT_FBFetchType; | 241 fFBFetchType = kEXT_FBFetchType; |
242 } else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { | 242 } else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { |
243 fFBFetchType = kNV_FBFetchType; | 243 fFBFetchType = kNV_FBFetchType; |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 this->initFSAASupport(ctxInfo, gli); | 247 this->initFSAASupport(ctxInfo, gli); |
248 this->initStencilFormats(ctxInfo); | 248 this->initStencilFormats(ctxInfo); |
249 | 249 |
250 /************************************************************************** | 250 /************************************************************************** |
251 * GrDrawTargetCaps fields | 251 * GrDrawTargetCaps fields |
252 **************************************************************************/ | 252 **************************************************************************/ |
253 GrGLint numFormats; | 253 GrGLint numFormats; |
254 GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats); | 254 GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats); |
255 if (numFormats) { | 255 if (numFormats) { |
256 SkAutoSTMalloc<10, GrGLint> formats(numFormats); | 256 SkAutoSTMalloc<10, GrGLint> formats(numFormats); |
257 GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats); | 257 GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats); |
258 for (int i = 0; i < numFormats; ++i) { | 258 for (int i = 0; i < numFormats; ++i) { |
259 if (formats[i] == GR_GL_PALETTE8_RGBA8) { | 259 if (formats[i] == GR_GL_PALETTE8_RGBA8) { |
260 f8BitPaletteSupport = true; | 260 f8BitPaletteSupport = true; |
261 break; | 261 break; |
262 } | 262 } |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 if (kDesktop_GrGLBinding == binding) { | 266 if (kGL_GrGLStandard == standard) { |
267 // we could also look for GL_ATI_separate_stencil extension or | 267 // we could also look for GL_ATI_separate_stencil extension or |
268 // GL_EXT_stencil_two_side but they use different function signatures | 268 // GL_EXT_stencil_two_side but they use different function signatures |
269 // than GL2.0+ (and than each other). | 269 // than GL2.0+ (and than each other). |
270 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); | 270 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); |
271 // supported on GL 1.4 and higher or by extension | 271 // supported on GL 1.4 and higher or by extension |
272 fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) || | 272 fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) || |
273 ctxInfo.hasExtension("GL_EXT_stencil_wrap"); | 273 ctxInfo.hasExtension("GL_EXT_stencil_wrap"); |
274 } else { | 274 } else { |
275 // ES 2 has two sided stencil and stencil wrap | 275 // ES 2 has two sided stencil and stencil wrap |
276 fTwoSidedStencilSupport = true; | 276 fTwoSidedStencilSupport = true; |
277 fStencilWrapOpsSupport = true; | 277 fStencilWrapOpsSupport = true; |
278 } | 278 } |
279 | 279 |
280 if (kDesktop_GrGLBinding == binding) { | 280 if (kGL_GrGLStandard == standard) { |
281 fBufferLockSupport = true; // we require VBO support and the desktop VBO
extension includes | 281 fBufferLockSupport = true; // we require VBO support and the desktop VBO
extension includes |
282 // glMapBuffer. | 282 // glMapBuffer. |
283 } else { | 283 } else { |
284 fBufferLockSupport = ctxInfo.hasExtension("GL_OES_mapbuffer"); | 284 fBufferLockSupport = ctxInfo.hasExtension("GL_OES_mapbuffer"); |
285 } | 285 } |
286 | 286 |
287 if (kDesktop_GrGLBinding == binding) { | 287 if (kGL_GrGLStandard == standard) { |
288 SkASSERT(ctxInfo.version() >= GR_GL_VER(2,0) || | 288 SkASSERT(ctxInfo.version() >= GR_GL_VER(2,0) || |
289 ctxInfo.hasExtension("GL_ARB_texture_non_power_of_two")); | 289 ctxInfo.hasExtension("GL_ARB_texture_non_power_of_two")); |
290 fNPOTTextureTileSupport = true; | 290 fNPOTTextureTileSupport = true; |
291 fMipMapSupport = true; | 291 fMipMapSupport = true; |
292 } else { | 292 } else { |
293 // Unextended ES2 supports NPOT textures with clamp_to_edge and non-mip
filters only | 293 // Unextended ES2 supports NPOT textures with clamp_to_edge and non-mip
filters only |
294 // ES3 has no limitations. | 294 // ES3 has no limitations. |
295 fNPOTTextureTileSupport = ctxInfo.version() >= GR_GL_VER(3,0) || | 295 fNPOTTextureTileSupport = ctxInfo.version() >= GR_GL_VER(3,0) || |
296 ctxInfo.hasExtension("GL_OES_texture_npot"); | 296 ctxInfo.hasExtension("GL_OES_texture_npot"); |
297 // ES2 supports MIP mapping for POT textures but our caps don't allow fo
r limited MIP | 297 // ES2 supports MIP mapping for POT textures but our caps don't allow fo
r limited MIP |
298 // support. The OES extension or ES 3.0 allow for MIPS on NPOT textures.
So, apparently, | 298 // support. The OES extension or ES 3.0 allow for MIPS on NPOT textures.
So, apparently, |
299 // does the undocumented GL_IMG_texture_npot extension. This extension d
oes not seem to | 299 // does the undocumented GL_IMG_texture_npot extension. This extension d
oes not seem to |
300 // to alllow arbitrary wrap modes, however. | 300 // to alllow arbitrary wrap modes, however. |
301 fMipMapSupport = fNPOTTextureTileSupport || ctxInfo.hasExtension("GL_IMG
_texture_npot"); | 301 fMipMapSupport = fNPOTTextureTileSupport || ctxInfo.hasExtension("GL_IMG
_texture_npot"); |
302 } | 302 } |
303 | 303 |
304 fHWAALineSupport = (kDesktop_GrGLBinding == binding); | 304 fHWAALineSupport = (kGL_GrGLStandard == standard); |
305 | 305 |
306 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); | 306 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); |
307 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); | 307 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); |
308 // Our render targets are always created with textures as the color | 308 // Our render targets are always created with textures as the color |
309 // attachment, hence this min: | 309 // attachment, hence this min: |
310 fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize); | 310 fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize); |
311 | 311 |
312 fPathRenderingSupport = GR_GL_USE_NV_PATH_RENDERING && | 312 fPathRenderingSupport = GR_GL_USE_NV_PATH_RENDERING && |
313 ctxInfo.hasExtension("GL_NV_path_rendering"); | 313 ctxInfo.hasExtension("GL_NV_path_rendering"); |
314 SkASSERT(!fPathRenderingSupport || fFixedFunctionSupport); | 314 SkASSERT(!fPathRenderingSupport || fFixedFunctionSupport); |
315 | 315 |
316 fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; | 316 fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; |
317 | 317 |
318 // Disable scratch texture reuse on Mali and Adreno devices | 318 // Disable scratch texture reuse on Mali and Adreno devices |
319 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && | 319 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && |
320 kQualcomm_GrGLVendor != ctxInfo.vendor(); | 320 kQualcomm_GrGLVendor != ctxInfo.vendor(); |
321 | 321 |
322 // Enable supported shader-related caps | 322 // Enable supported shader-related caps |
323 if (kDesktop_GrGLBinding == binding) { | 323 if (kGL_GrGLStandard == standard) { |
324 fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) || | 324 fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) || |
325 ctxInfo.hasExtension("GL_ARB_blend_func_ext
ended"); | 325 ctxInfo.hasExtension("GL_ARB_blend_func_ext
ended"); |
326 fShaderDerivativeSupport = true; | 326 fShaderDerivativeSupport = true; |
327 // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS | 327 // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS |
328 fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) && | 328 fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) && |
329 ctxInfo.glslGeneration() >= k150_GrGLSLGenerati
on; | 329 ctxInfo.glslGeneration() >= k150_GrGLSLGenerati
on; |
330 } else { | 330 } else { |
331 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat
ives"); | 331 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat
ives"); |
332 } | 332 } |
333 | 333 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 368 |
369 // ES 3.0 | 369 // ES 3.0 |
370 // Same as ES 2.0 except R8 and RGBA8 are supported without extensions (the
functions called | 370 // Same as ES 2.0 except R8 and RGBA8 are supported without extensions (the
functions called |
371 // below already account for this). | 371 // below already account for this). |
372 | 372 |
373 enum { | 373 enum { |
374 kNo_MSAA = 0, | 374 kNo_MSAA = 0, |
375 kYes_MSAA = 1, | 375 kYes_MSAA = 1, |
376 }; | 376 }; |
377 | 377 |
378 if (kDesktop_GrGLBinding == ctxInfo.binding()) { | 378 if (kGL_GrGLStandard == ctxInfo.standard()) { |
379 // Post 3.0 we will get R8 | 379 // Post 3.0 we will get R8 |
380 // Prior to 3.0 we will get ALPHA8 (with GL_ARB_framebuffer_object) | 380 // Prior to 3.0 we will get ALPHA8 (with GL_ARB_framebuffer_object) |
381 if (ctxInfo.version() >= GR_GL_VER(3,0) || | 381 if (ctxInfo.version() >= GR_GL_VER(3,0) || |
382 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { | 382 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { |
383 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = true; | 383 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = true; |
384 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = true; | 384 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = true; |
385 } | 385 } |
386 } else { | 386 } else { |
387 // On ES we can only hope for R8 | 387 // On ES we can only hope for R8 |
388 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = fTextureRedSupp
ort; | 388 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = fTextureRedSupp
ort; |
389 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSup
port; | 389 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSup
port; |
390 } | 390 } |
391 | 391 |
392 if (kDesktop_GrGLBinding != ctxInfo.binding()) { | 392 if (kGL_GrGLStandard != ctxInfo.standard()) { |
393 // only available in ES | 393 // only available in ES |
394 fConfigRenderSupport[kRGB_565_GrPixelConfig][kNo_MSAA] = true; | 394 fConfigRenderSupport[kRGB_565_GrPixelConfig][kNo_MSAA] = true; |
395 fConfigRenderSupport[kRGB_565_GrPixelConfig][kYes_MSAA] = true; | 395 fConfigRenderSupport[kRGB_565_GrPixelConfig][kYes_MSAA] = true; |
396 } | 396 } |
397 | 397 |
398 // we no longer support 444 as a render target | 398 // we no longer support 444 as a render target |
399 fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kNo_MSAA] = false; | 399 fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kNo_MSAA] = false; |
400 fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kYes_MSAA] = false; | 400 fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kYes_MSAA] = false; |
401 | 401 |
402 if (this->fRGBA8RenderbufferSupport) { | 402 if (this->fRGBA8RenderbufferSupport) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 GR_GL_GetIntegerv(intf, | 451 GR_GL_GetIntegerv(intf, |
452 GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, | 452 GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, |
453 &otherType); | 453 &otherType); |
454 | 454 |
455 return (GrGLenum)otherFormat == format && (GrGLenum)otherType == type; | 455 return (GrGLenum)otherFormat == format && (GrGLenum)otherType == type; |
456 } | 456 } |
457 | 457 |
458 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
ce* gli) { | 458 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
ce* gli) { |
459 | 459 |
460 fMSFBOType = kNone_MSFBOType; | 460 fMSFBOType = kNone_MSFBOType; |
461 if (kDesktop_GrGLBinding != ctxInfo.binding()) { | 461 if (kGL_GrGLStandard != ctxInfo.standard()) { |
462 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed | 462 // We prefer the EXT/IMG extension over ES3 MSAA because we've observed |
463 // ES3 driver bugs on at least one device with a tiled GPU (N10). | 463 // ES3 driver bugs on at least one device with a tiled GPU (N10). |
464 if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) { | 464 if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) { |
465 fMSFBOType = kES_EXT_MsToTexture_MSFBOType; | 465 fMSFBOType = kES_EXT_MsToTexture_MSFBOType; |
466 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")
) { | 466 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")
) { |
467 fMSFBOType = kES_IMG_MsToTexture_MSFBOType; | 467 fMSFBOType = kES_IMG_MsToTexture_MSFBOType; |
468 } else if (!GR_GL_IGNORE_ES3_MSAA && ctxInfo.version() >= GR_GL_VER(3,0)
) { | 468 } else if (!GR_GL_IGNORE_ES3_MSAA && ctxInfo.version() >= GR_GL_VER(3,0)
) { |
469 fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; | 469 fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; |
470 } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample"))
{ | 470 } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample"))
{ |
471 // chrome's extension is equivalent to the EXT msaa | 471 // chrome's extension is equivalent to the EXT msaa |
(...skipping 27 matching lines...) Expand all Loading... |
499 | 499 |
500 static const StencilFormat | 500 static const StencilFormat |
501 // internal Format stencil bits total bits pa
cked? | 501 // internal Format stencil bits total bits pa
cked? |
502 gS8 = {GR_GL_STENCIL_INDEX8, 8, 8, fa
lse}, | 502 gS8 = {GR_GL_STENCIL_INDEX8, 8, 8, fa
lse}, |
503 gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, fa
lse}, | 503 gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, fa
lse}, |
504 gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, tr
ue }, | 504 gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, tr
ue }, |
505 gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, fa
lse}, | 505 gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, fa
lse}, |
506 // gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, fa
lse}, | 506 // gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, fa
lse}, |
507 gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, tr
ue }; | 507 gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, tr
ue }; |
508 | 508 |
509 if (kDesktop_GrGLBinding == ctxInfo.binding()) { | 509 if (kGL_GrGLStandard == ctxInfo.standard()) { |
510 bool supportsPackedDS = | 510 bool supportsPackedDS = |
511 ctxInfo.version() >= GR_GL_VER(3,0) || | 511 ctxInfo.version() >= GR_GL_VER(3,0) || |
512 ctxInfo.hasExtension("GL_EXT_packed_depth_stencil") || | 512 ctxInfo.hasExtension("GL_EXT_packed_depth_stencil") || |
513 ctxInfo.hasExtension("GL_ARB_framebuffer_object"); | 513 ctxInfo.hasExtension("GL_ARB_framebuffer_object"); |
514 | 514 |
515 // S1 thru S16 formats are in GL 3.0+, EXT_FBO, and ARB_FBO since we | 515 // S1 thru S16 formats are in GL 3.0+, EXT_FBO, and ARB_FBO since we |
516 // require FBO support we can expect these are legal formats and don't | 516 // require FBO support we can expect these are legal formats and don't |
517 // check. These also all support the unsized GL_STENCIL_INDEX. | 517 // check. These also all support the unsized GL_STENCIL_INDEX. |
518 fStencilFormats.push_back() = gS8; | 518 fStencilFormats.push_back() = gS8; |
519 fStencilFormats.push_back() = gS16; | 519 fStencilFormats.push_back() = gS16; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 655 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
656 r.appendf("Fragment coord conventions support: %s\n", | 656 r.appendf("Fragment coord conventions support: %s\n", |
657 (fFragCoordsConventionSupport ? "YES": "NO")); | 657 (fFragCoordsConventionSupport ? "YES": "NO")); |
658 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); | 658 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); |
659 r.appendf("Use non-VBO for dynamic data: %s\n", | 659 r.appendf("Use non-VBO for dynamic data: %s\n", |
660 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 660 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
661 r.appendf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" :
"NO")); | 661 r.appendf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" :
"NO")); |
662 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); | 662 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); |
663 return r; | 663 return r; |
664 } | 664 } |
OLD | NEW |