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 #ifndef GrGLCaps_DEFINED | 9 #ifndef GrGLCaps_DEFINED |
10 #define GrGLCaps_DEFINED | 10 #define GrGLCaps_DEFINED |
11 | 11 |
12 #include "GrDrawTargetCaps.h" | 12 #include "GrDrawTargetCaps.h" |
13 #include "GrGLStencilBuffer.h" | 13 #include "GrGLStencilBuffer.h" |
14 #include "SkTArray.h" | 14 #include "SkTArray.h" |
15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
| 16 #include "SkTDynamicHash.h" |
16 | 17 |
17 class GrGLContextInfo; | 18 class GrGLContextInfo; |
18 | 19 |
19 /** | 20 /** |
20 * Stores some capabilities of a GL context. Most are determined by the GL | 21 * Stores some capabilities of a GL context. Most are determined by the GL |
21 * version and the extensions string. It also tracks formats that have passed | 22 * version and the extensions string. It also tracks formats that have passed |
22 * the FBO completeness test. | 23 * the FBO completeness test. |
23 */ | 24 */ |
24 class GrGLCaps : public GrDrawTargetCaps { | 25 class GrGLCaps : public GrDrawTargetCaps { |
25 public: | 26 public: |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; } | 247 bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; } |
247 | 248 |
248 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic conte
nt. | 249 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic conte
nt. |
249 bool useNonVBOVertexAndIndexDynamicData() const { | 250 bool useNonVBOVertexAndIndexDynamicData() const { |
250 return fUseNonVBOVertexAndIndexDynamicData; | 251 return fUseNonVBOVertexAndIndexDynamicData; |
251 } | 252 } |
252 | 253 |
253 /// Does ReadPixels support the provided format/type combo? | 254 /// Does ReadPixels support the provided format/type combo? |
254 bool readPixelsSupported(const GrGLInterface* intf, | 255 bool readPixelsSupported(const GrGLInterface* intf, |
255 GrGLenum format, | 256 GrGLenum format, |
256 GrGLenum type) const; | 257 GrGLenum type, |
| 258 GrGLenum currFboFormat) const; |
257 | 259 |
258 bool isCoreProfile() const { return fIsCoreProfile; } | 260 bool isCoreProfile() const { return fIsCoreProfile; } |
259 | 261 |
260 | 262 |
261 bool fullClearIsFree() const { return fFullClearIsFree; } | 263 bool fullClearIsFree() const { return fFullClearIsFree; } |
262 | 264 |
263 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } | 265 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } |
264 | 266 |
265 /** | 267 /** |
266 * Returns a string containing the caps info. | 268 * Returns a string containing the caps info. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx)); | 319 return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx)); |
318 } | 320 } |
319 }; | 321 }; |
320 | 322 |
321 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); | 323 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); |
322 void initStencilFormats(const GrGLContextInfo&); | 324 void initStencilFormats(const GrGLContextInfo&); |
323 // This must be called after initFSAASupport(). | 325 // This must be called after initFSAASupport(). |
324 void initConfigRenderableTable(const GrGLContextInfo&); | 326 void initConfigRenderableTable(const GrGLContextInfo&); |
325 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*)
; | 327 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*)
; |
326 | 328 |
| 329 bool doReadPixelsSupported(const GrGLInterface* intf, |
| 330 GrGLenum format, |
| 331 GrGLenum type) const; |
| 332 |
327 // tracks configs that have been verified to pass the FBO completeness when | 333 // tracks configs that have been verified to pass the FBO completeness when |
328 // used as a color attachment | 334 // used as a color attachment |
329 VerifiedColorConfigs fVerifiedColorConfigs; | 335 VerifiedColorConfigs fVerifiedColorConfigs; |
330 | 336 |
331 SkTArray<StencilFormat, true> fStencilFormats; | 337 SkTArray<StencilFormat, true> fStencilFormats; |
332 // tracks configs that have been verified to pass the FBO completeness when | 338 // tracks configs that have been verified to pass the FBO completeness when |
333 // used as a color attachment when a particular stencil format is used | 339 // used as a color attachment when a particular stencil format is used |
334 // as a stencil attachment. | 340 // as a stencil attachment. |
335 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs; | 341 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs; |
336 | 342 |
(...skipping 20 matching lines...) Expand all Loading... |
357 bool fTextureRedSupport : 1; | 363 bool fTextureRedSupport : 1; |
358 bool fImagingSupport : 1; | 364 bool fImagingSupport : 1; |
359 bool fTwoFormatLimit : 1; | 365 bool fTwoFormatLimit : 1; |
360 bool fFragCoordsConventionSupport : 1; | 366 bool fFragCoordsConventionSupport : 1; |
361 bool fVertexArrayObjectSupport : 1; | 367 bool fVertexArrayObjectSupport : 1; |
362 bool fUseNonVBOVertexAndIndexDynamicData : 1; | 368 bool fUseNonVBOVertexAndIndexDynamicData : 1; |
363 bool fIsCoreProfile : 1; | 369 bool fIsCoreProfile : 1; |
364 bool fFullClearIsFree : 1; | 370 bool fFullClearIsFree : 1; |
365 bool fDropsTileOnZeroDivide : 1; | 371 bool fDropsTileOnZeroDivide : 1; |
366 | 372 |
| 373 struct ReadPixelsSupportedFormatsKey { |
| 374 GrGLenum fFormat; |
| 375 GrGLenum fType; |
| 376 GrGLenum fFboFormat; |
| 377 |
| 378 bool operator==(const ReadPixelsSupportedFormatsKey& rhs) const { |
| 379 return fFormat == rhs.fFormat |
| 380 && fType == rhs.fType |
| 381 && fFboFormat == rhs.fFboFormat; |
| 382 } |
| 383 }; |
| 384 |
| 385 class ReadPixelsSupportedFormats { |
| 386 public: |
| 387 ReadPixelsSupportedFormats(ReadPixelsSupportedFormatsKey key, |
| 388 bool value) |
| 389 :fKey(key), fValue(value) { |
| 390 } |
| 391 |
| 392 static const ReadPixelsSupportedFormatsKey& GetKey(const ReadPixelsSuppo
rtedFormats& element) { |
| 393 return element.fKey; |
| 394 } |
| 395 static uint32_t Hash(const ReadPixelsSupportedFormatsKey&); |
| 396 |
| 397 bool value() const { return fValue; } |
| 398 private: |
| 399 ReadPixelsSupportedFormatsKey fKey; |
| 400 bool fValue; |
| 401 }; |
| 402 |
| 403 mutable SkTDynamicHash<ReadPixelsSupportedFormats, ReadPixelsSupportedFormat
sKey> fReadPixelsSupportedCache; |
| 404 |
367 typedef GrDrawTargetCaps INHERITED; | 405 typedef GrDrawTargetCaps INHERITED; |
368 }; | 406 }; |
369 | 407 |
370 #endif | 408 #endif |
OLD | NEW |