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 GrGLSLCaps_DEFINED | 9 #ifndef GrGLSLCaps_DEFINED |
10 #define GrGLSLCaps_DEFINED | 10 #define GrGLSLCaps_DEFINED |
11 | 11 |
12 #include "GrCaps.h" | 12 #include "GrCaps.h" |
13 #include "GrGLSL.h" | 13 #include "GrGLSL.h" |
| 14 #include "GrSwizzle.h" |
14 | 15 |
15 class GrGLSLCaps : public GrShaderCaps { | 16 class GrGLSLCaps : public GrShaderCaps { |
16 public: | 17 public: |
17 | 18 |
18 | 19 |
19 /** | 20 /** |
20 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires | 21 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires |
21 * special layout qualifiers in the fragment shader. | 22 * special layout qualifiers in the fragment shader. |
22 */ | 23 */ |
23 enum AdvBlendEqInteraction { | 24 enum AdvBlendEqInteraction { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // extension is required. However, the return value of this function does no
t say whether dual | 98 // extension is required. However, the return value of this function does no
t say whether dual |
98 // source blending is supported. | 99 // source blending is supported. |
99 const char* secondaryOutputExtensionString() const { | 100 const char* secondaryOutputExtensionString() const { |
100 return fSecondaryOutputExtensionString; | 101 return fSecondaryOutputExtensionString; |
101 } | 102 } |
102 | 103 |
103 const char* externalTextureExtensionString() const { | 104 const char* externalTextureExtensionString() const { |
104 return fExternalTextureExtensionString; | 105 return fExternalTextureExtensionString; |
105 } | 106 } |
106 | 107 |
107 bool mustSwizzleInShader() const { return fMustSwizzleInShader; } | |
108 | |
109 /** | 108 /** |
110 * Returns a string which represents how to map from an internal GLFormat to
a given | 109 * Given a texture's config, this determines what swizzle must be appended t
o accesses to the |
111 * GrPixelConfig. The function mustSwizzleInShader determines whether this s
wizzle is applied | 110 * texture in generated shader code. Swizzling may be implemented in texture
parameters or a |
112 * in the generated shader code or using sample state in the 3D API. | 111 * sampler rather than in the shader. In this case the shader swizzle will a
lways be "rgba". |
113 */ | 112 */ |
114 const char* getSwizzleMap(GrPixelConfig config) const { return fConfigSwizzl
e[config]; } | 113 const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const { |
| 114 return fConfigTextureSwizzle[config]; |
| 115 } |
115 | 116 |
116 GrGLSLGeneration generation() const { return fGLSLGeneration; } | 117 GrGLSLGeneration generation() const { return fGLSLGeneration; } |
117 | 118 |
118 /** | 119 /** |
119 * Returns a string containing the caps info. | 120 * Returns a string containing the caps info. |
120 */ | 121 */ |
121 SkString dump() const override; | 122 SkString dump() const override; |
122 | 123 |
123 private: | 124 private: |
124 void onApplyOptionsOverrides(const GrContextOptions& options) override; | 125 void onApplyOptionsOverrides(const GrContextOptions& options) override; |
(...skipping 16 matching lines...) Expand all Loading... |
141 const char* fShaderDerivativeExtensionString; | 142 const char* fShaderDerivativeExtensionString; |
142 const char* fFragCoordConventionsExtensionString; | 143 const char* fFragCoordConventionsExtensionString; |
143 const char* fSecondaryOutputExtensionString; | 144 const char* fSecondaryOutputExtensionString; |
144 const char* fExternalTextureExtensionString; | 145 const char* fExternalTextureExtensionString; |
145 | 146 |
146 const char* fFBFetchColorName; | 147 const char* fFBFetchColorName; |
147 const char* fFBFetchExtensionString; | 148 const char* fFBFetchExtensionString; |
148 | 149 |
149 AdvBlendEqInteraction fAdvBlendEqInteraction; | 150 AdvBlendEqInteraction fAdvBlendEqInteraction; |
150 | 151 |
151 bool fMustSwizzleInShader; | 152 GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt]; |
152 const char* fConfigSwizzle[kGrPixelConfigCnt]; | |
153 | 153 |
154 friend class GrGLCaps; // For initialization. | 154 friend class GrGLCaps; // For initialization. |
155 | 155 |
156 typedef GrShaderCaps INHERITED; | 156 typedef GrShaderCaps INHERITED; |
157 }; | 157 }; |
158 | 158 |
159 | |
160 #endif | 159 #endif |
OLD | NEW |