OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2012 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 |
| 9 #ifndef GrGLSLCaps_DEFINED |
| 10 #define GrGLSLCaps_DEFINED |
| 11 |
| 12 #include "GrCaps.h" |
| 13 #include "GrGLSL.h" |
| 14 |
| 15 class GrGLSLCaps : public GrShaderCaps { |
| 16 public: |
| 17 SK_DECLARE_INST_COUNT(GrGLSLCaps) |
| 18 |
| 19 /** |
| 20 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires |
| 21 * special layout qualifiers in the fragment shader. |
| 22 */ |
| 23 enum AdvBlendEqInteraction { |
| 24 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advance
d extension |
| 25 kAutomatic_AdvBlendEqInteraction, //<! No interaction required |
| 26 kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_e
quations) out |
| 27 kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers
per equation |
| 28 |
| 29 kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction |
| 30 }; |
| 31 |
| 32 /** |
| 33 * Initializes the GrGLSLCaps to a default set of features |
| 34 */ |
| 35 GrGLSLCaps(const GrContextOptions&); |
| 36 |
| 37 /** |
| 38 * Some helper functions for encapsulating various extensions to read FB Buf
fer on openglES |
| 39 * |
| 40 * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar
to this effect |
| 41 */ |
| 42 bool fbFetchSupport() const { return fFBFetchSupport; } |
| 43 |
| 44 bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; } |
| 45 |
| 46 bool bindlessTextureSupport() const { return fBindlessTextureSupport; } |
| 47 |
| 48 const char* fbFetchColorName() const { return fFBFetchColorName; } |
| 49 |
| 50 const char* fbFetchExtensionString() const { return fFBFetchExtensionString;
} |
| 51 |
| 52 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } |
| 53 |
| 54 AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInte
raction; } |
| 55 |
| 56 bool mustEnableAdvBlendEqs() const { |
| 57 return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction; |
| 58 } |
| 59 |
| 60 bool mustEnableSpecificAdvBlendEqs() const { |
| 61 return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction; |
| 62 } |
| 63 |
| 64 bool mustDeclareFragmentShaderOutput() const { |
| 65 return fGLSLGeneration > k110_GrGLSLGeneration; |
| 66 } |
| 67 |
| 68 GrGLSLGeneration generation() const { return fGLSLGeneration; } |
| 69 |
| 70 /** |
| 71 * Returns a string containing the caps info. |
| 72 */ |
| 73 SkString dump() const override; |
| 74 |
| 75 private: |
| 76 GrGLSLGeneration fGLSLGeneration; |
| 77 |
| 78 bool fDropsTileOnZeroDivide : 1; |
| 79 bool fFBFetchSupport : 1; |
| 80 bool fFBFetchNeedsCustomOutput : 1; |
| 81 bool fBindlessTextureSupport : 1; |
| 82 |
| 83 const char* fFBFetchColorName; |
| 84 const char* fFBFetchExtensionString; |
| 85 |
| 86 AdvBlendEqInteraction fAdvBlendEqInteraction; |
| 87 |
| 88 friend class GrGLCaps; // For initialization. |
| 89 |
| 90 typedef GrShaderCaps INHERITED; |
| 91 }; |
| 92 |
| 93 |
| 94 #endif |
OLD | NEW |