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 "GrCaps.h" | 12 #include "GrCaps.h" |
| 13 #include "GrGLSL.h" |
13 #include "GrGLStencilAttachment.h" | 14 #include "GrGLStencilAttachment.h" |
14 #include "SkChecksum.h" | 15 #include "SkChecksum.h" |
15 #include "SkTHash.h" | 16 #include "SkTHash.h" |
16 #include "SkTArray.h" | 17 #include "SkTArray.h" |
17 | 18 |
18 class GrGLContextInfo; | 19 class GrGLContextInfo; |
19 class GrGLSLCaps; | 20 class GrGLSLCaps; |
20 | 21 |
21 /** | 22 /** |
22 * Stores some capabilities of a GL context. Most are determined by the GL | 23 * Stores some capabilities of a GL context. Most are determined by the GL |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 return fFormat == rhs.fFormat | 360 return fFormat == rhs.fFormat |
360 && fType == rhs.fType | 361 && fType == rhs.fType |
361 && fFboFormat == rhs.fFboFormat; | 362 && fFboFormat == rhs.fFboFormat; |
362 } | 363 } |
363 }; | 364 }; |
364 mutable SkTHashMap<ReadPixelsSupportedFormat, bool> fReadPixelsSupportedCach
e; | 365 mutable SkTHashMap<ReadPixelsSupportedFormat, bool> fReadPixelsSupportedCach
e; |
365 | 366 |
366 typedef GrCaps INHERITED; | 367 typedef GrCaps INHERITED; |
367 }; | 368 }; |
368 | 369 |
369 | |
370 class GrGLSLCaps : public GrShaderCaps { | 370 class GrGLSLCaps : public GrShaderCaps { |
371 public: | 371 public: |
372 SK_DECLARE_INST_COUNT(GrGLSLCaps) | 372 SK_DECLARE_INST_COUNT(GrGLSLCaps) |
373 | 373 |
374 /** | 374 /** |
375 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires | 375 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires |
376 * special layout qualifiers in the fragment shader. | 376 * special layout qualifiers in the fragment shader. |
377 */ | 377 */ |
378 enum AdvBlendEqInteraction { | 378 enum AdvBlendEqInteraction { |
379 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advance
d extension | 379 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advance
d extension |
(...skipping 28 matching lines...) Expand all Loading... |
408 | 408 |
409 AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInte
raction; } | 409 AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInte
raction; } |
410 | 410 |
411 bool mustEnableAdvBlendEqs() const { | 411 bool mustEnableAdvBlendEqs() const { |
412 return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction; | 412 return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction; |
413 } | 413 } |
414 | 414 |
415 bool mustEnableSpecificAdvBlendEqs() const { | 415 bool mustEnableSpecificAdvBlendEqs() const { |
416 return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction; | 416 return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction; |
417 } | 417 } |
| 418 |
| 419 bool mustDeclareFragmentShaderOutput() const { |
| 420 return fGLSLGeneration > k110_GrGLSLGeneration; |
| 421 } |
| 422 |
| 423 GrGLSLGeneration generation() const { return fGLSLGeneration; } |
418 | 424 |
419 /** | 425 /** |
420 * Returns a string containing the caps info. | 426 * Returns a string containing the caps info. |
421 */ | 427 */ |
422 SkString dump() const override; | 428 SkString dump() const override; |
423 | 429 |
424 private: | 430 private: |
425 void init(const GrGLContextInfo&, const GrGLInterface*, const GrGLCaps&); | 431 void init(const GrGLContextInfo&, const GrGLInterface*, const GrGLCaps&); |
426 | 432 |
427 // Must be called after fGeometryShaderSupport is initialized. | 433 // Must be called after fGeometryShaderSupport is initialized. |
428 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); | 434 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); |
429 | 435 |
| 436 GrGLSLGeneration fGLSLGeneration; |
| 437 |
430 bool fDropsTileOnZeroDivide : 1; | 438 bool fDropsTileOnZeroDivide : 1; |
431 bool fFBFetchSupport : 1; | 439 bool fFBFetchSupport : 1; |
432 bool fFBFetchNeedsCustomOutput : 1; | 440 bool fFBFetchNeedsCustomOutput : 1; |
433 | 441 |
434 const char* fFBFetchColorName; | 442 const char* fFBFetchColorName; |
435 const char* fFBFetchExtensionString; | 443 const char* fFBFetchExtensionString; |
436 | 444 |
437 AdvBlendEqInteraction fAdvBlendEqInteraction; | 445 AdvBlendEqInteraction fAdvBlendEqInteraction; |
438 | 446 |
439 typedef GrShaderCaps INHERITED; | 447 typedef GrShaderCaps INHERITED; |
440 }; | 448 }; |
441 | 449 |
442 | 450 |
443 #endif | 451 #endif |
OLD | NEW |