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 "SkChecksum.h" | 14 #include "SkChecksum.h" |
15 #include "SkTHashCache.h" | 15 #include "SkTHash.h" |
16 #include "SkTArray.h" | 16 #include "SkTArray.h" |
17 | 17 |
18 class GrGLContextInfo; | 18 class GrGLContextInfo; |
19 | 19 |
20 /** | 20 /** |
21 * 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 |
22 * 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 |
23 * the FBO completeness test. | 23 * the FBO completeness test. |
24 */ | 24 */ |
25 class GrGLCaps : public GrDrawTargetCaps { | 25 class GrGLCaps : public GrDrawTargetCaps { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 bool fUseNonVBOVertexAndIndexDynamicData : 1; | 386 bool fUseNonVBOVertexAndIndexDynamicData : 1; |
387 bool fIsCoreProfile : 1; | 387 bool fIsCoreProfile : 1; |
388 bool fFullClearIsFree : 1; | 388 bool fFullClearIsFree : 1; |
389 bool fDropsTileOnZeroDivide : 1; | 389 bool fDropsTileOnZeroDivide : 1; |
390 bool fFBFetchSupport : 1; | 390 bool fFBFetchSupport : 1; |
391 bool fFBFetchNeedsCustomOutput : 1; | 391 bool fFBFetchNeedsCustomOutput : 1; |
392 | 392 |
393 const char* fFBFetchColorName; | 393 const char* fFBFetchColorName; |
394 const char* fFBFetchExtensionString; | 394 const char* fFBFetchExtensionString; |
395 | 395 |
396 class ReadPixelsSupportedFormats { | 396 struct ReadPixelsSupportedFormat { |
397 public: | 397 GrGLenum fFormat; |
398 struct Key { | 398 GrGLenum fType; |
399 GrGLenum fFormat; | 399 GrGLenum fFboFormat; |
400 GrGLenum fType; | |
401 GrGLenum fFboFormat; | |
402 | 400 |
403 bool operator==(const Key& rhs) const { | 401 bool operator==(const ReadPixelsSupportedFormat& rhs) const { |
404 return fFormat == rhs.fFormat | 402 return fFormat == rhs.fFormat |
405 && fType == rhs.fType | 403 && fType == rhs.fType |
406 && fFboFormat == rhs.fFboFormat; | 404 && fFboFormat == rhs.fFboFormat; |
407 } | |
408 | |
409 uint32_t getHash() const { | |
410 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(thi
s), sizeof(*this)); | |
411 } | |
412 }; | |
413 | |
414 ReadPixelsSupportedFormats(Key key, bool value) : fKey(key), fValue(valu
e) { | |
415 } | 405 } |
416 | 406 static uint32_t Hash(const ReadPixelsSupportedFormat& r) { |
417 static const Key& GetKey(const ReadPixelsSupportedFormats& element) { | 407 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&r), si
zeof(r)); |
418 return element.fKey; | |
419 } | 408 } |
420 | |
421 static uint32_t Hash(const Key& key) { | |
422 return key.getHash(); | |
423 } | |
424 | |
425 bool value() const { | |
426 return fValue; | |
427 } | |
428 private: | |
429 Key fKey; | |
430 bool fValue; | |
431 }; | 409 }; |
432 | 410 |
433 mutable SkTHashCache<ReadPixelsSupportedFormats, | 411 mutable SkTHashMap<ReadPixelsSupportedFormat, bool, ReadPixelsSupportedForma
t::Hash> |
434 ReadPixelsSupportedFormats::Key> fReadPixelsSupportedCa
che; | 412 fReadPixelsSupportedCache; |
435 | 413 |
436 typedef GrDrawTargetCaps INHERITED; | 414 typedef GrDrawTargetCaps INHERITED; |
437 }; | 415 }; |
438 | 416 |
439 #endif | 417 #endif |
OLD | NEW |