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" | |
17 | 16 |
18 class GrGLContextInfo; | 17 class GrGLContextInfo; |
19 | 18 |
20 /** | 19 /** |
21 * Stores some capabilities of a GL context. Most are determined by the GL | 20 * Stores some capabilities of a GL context. Most are determined by the GL |
22 * version and the extensions string. It also tracks formats that have passed | 21 * version and the extensions string. It also tracks formats that have passed |
23 * the FBO completeness test. | 22 * the FBO completeness test. |
24 */ | 23 */ |
25 class GrGLCaps : public GrDrawTargetCaps { | 24 class GrGLCaps : public GrDrawTargetCaps { |
26 public: | 25 public: |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; } | 246 bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; } |
248 | 247 |
249 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic conte
nt. | 248 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic conte
nt. |
250 bool useNonVBOVertexAndIndexDynamicData() const { | 249 bool useNonVBOVertexAndIndexDynamicData() const { |
251 return fUseNonVBOVertexAndIndexDynamicData; | 250 return fUseNonVBOVertexAndIndexDynamicData; |
252 } | 251 } |
253 | 252 |
254 /// Does ReadPixels support the provided format/type combo? | 253 /// Does ReadPixels support the provided format/type combo? |
255 bool readPixelsSupported(const GrGLInterface* intf, | 254 bool readPixelsSupported(const GrGLInterface* intf, |
256 GrGLenum format, | 255 GrGLenum format, |
257 GrGLenum type, | 256 GrGLenum type) const; |
258 GrGLenum currFboFormat) const; | |
259 | 257 |
260 bool isCoreProfile() const { return fIsCoreProfile; } | 258 bool isCoreProfile() const { return fIsCoreProfile; } |
261 | 259 |
262 | 260 |
263 bool fullClearIsFree() const { return fFullClearIsFree; } | 261 bool fullClearIsFree() const { return fFullClearIsFree; } |
264 | 262 |
265 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } | 263 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } |
266 | 264 |
267 /** | 265 /** |
268 * Returns a string containing the caps info. | 266 * Returns a string containing the caps info. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx)); | 317 return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx)); |
320 } | 318 } |
321 }; | 319 }; |
322 | 320 |
323 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); | 321 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); |
324 void initStencilFormats(const GrGLContextInfo&); | 322 void initStencilFormats(const GrGLContextInfo&); |
325 // This must be called after initFSAASupport(). | 323 // This must be called after initFSAASupport(). |
326 void initConfigRenderableTable(const GrGLContextInfo&); | 324 void initConfigRenderableTable(const GrGLContextInfo&); |
327 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*)
; | 325 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*)
; |
328 | 326 |
329 bool doReadPixelsSupported(const GrGLInterface* intf, | |
330 GrGLenum format, | |
331 GrGLenum type) const; | |
332 | |
333 // tracks configs that have been verified to pass the FBO completeness when | 327 // tracks configs that have been verified to pass the FBO completeness when |
334 // used as a color attachment | 328 // used as a color attachment |
335 VerifiedColorConfigs fVerifiedColorConfigs; | 329 VerifiedColorConfigs fVerifiedColorConfigs; |
336 | 330 |
337 SkTArray<StencilFormat, true> fStencilFormats; | 331 SkTArray<StencilFormat, true> fStencilFormats; |
338 // tracks configs that have been verified to pass the FBO completeness when | 332 // tracks configs that have been verified to pass the FBO completeness when |
339 // used as a color attachment when a particular stencil format is used | 333 // used as a color attachment when a particular stencil format is used |
340 // as a stencil attachment. | 334 // as a stencil attachment. |
341 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs; | 335 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs; |
342 | 336 |
(...skipping 20 matching lines...) Expand all Loading... |
363 bool fTextureRedSupport : 1; | 357 bool fTextureRedSupport : 1; |
364 bool fImagingSupport : 1; | 358 bool fImagingSupport : 1; |
365 bool fTwoFormatLimit : 1; | 359 bool fTwoFormatLimit : 1; |
366 bool fFragCoordsConventionSupport : 1; | 360 bool fFragCoordsConventionSupport : 1; |
367 bool fVertexArrayObjectSupport : 1; | 361 bool fVertexArrayObjectSupport : 1; |
368 bool fUseNonVBOVertexAndIndexDynamicData : 1; | 362 bool fUseNonVBOVertexAndIndexDynamicData : 1; |
369 bool fIsCoreProfile : 1; | 363 bool fIsCoreProfile : 1; |
370 bool fFullClearIsFree : 1; | 364 bool fFullClearIsFree : 1; |
371 bool fDropsTileOnZeroDivide : 1; | 365 bool fDropsTileOnZeroDivide : 1; |
372 | 366 |
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 | |
405 typedef GrDrawTargetCaps INHERITED; | 367 typedef GrDrawTargetCaps INHERITED; |
406 }; | 368 }; |
407 | 369 |
408 #endif | 370 #endif |
OLD | NEW |