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" | |
14 #include "GrSwizzle.h" | 13 #include "GrSwizzle.h" |
15 | 14 |
| 15 // Limited set of GLSL versions we build shaders for. Caller should round |
| 16 // down the GLSL version to one of these enums. |
| 17 enum GrGLSLGeneration { |
| 18 /** |
| 19 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20) |
| 20 */ |
| 21 k110_GrGLSLGeneration, |
| 22 /** |
| 23 * Desktop GLSL 1.30 |
| 24 */ |
| 25 k130_GrGLSLGeneration, |
| 26 /** |
| 27 * Desktop GLSL 1.40 |
| 28 */ |
| 29 k140_GrGLSLGeneration, |
| 30 /** |
| 31 * Desktop GLSL 1.50 |
| 32 */ |
| 33 k150_GrGLSLGeneration, |
| 34 /** |
| 35 * Desktop GLSL 3.30, and ES GLSL 3.00 |
| 36 */ |
| 37 k330_GrGLSLGeneration, |
| 38 /** |
| 39 * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular |
| 40 */ |
| 41 k310es_GrGLSLGeneration, |
| 42 }; |
| 43 |
16 class GrGLSLCaps : public GrShaderCaps { | 44 class GrGLSLCaps : public GrShaderCaps { |
17 public: | 45 public: |
18 | |
19 | |
20 /** | 46 /** |
21 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires | 47 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires |
22 * special layout qualifiers in the fragment shader. | 48 * special layout qualifiers in the fragment shader. |
23 */ | 49 */ |
24 enum AdvBlendEqInteraction { | 50 enum AdvBlendEqInteraction { |
25 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advance
d extension | 51 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advance
d extension |
26 kAutomatic_AdvBlendEqInteraction, //<! No interaction required | 52 kAutomatic_AdvBlendEqInteraction, //<! No interaction required |
27 kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_e
quations) out | 53 kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_e
quations) out |
28 kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers
per equation | 54 kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers
per equation |
29 | 55 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // extension is required. However, the return value of this function does no
t say whether dual | 124 // extension is required. However, the return value of this function does no
t say whether dual |
99 // source blending is supported. | 125 // source blending is supported. |
100 const char* secondaryOutputExtensionString() const { | 126 const char* secondaryOutputExtensionString() const { |
101 return fSecondaryOutputExtensionString; | 127 return fSecondaryOutputExtensionString; |
102 } | 128 } |
103 | 129 |
104 const char* externalTextureExtensionString() const { | 130 const char* externalTextureExtensionString() const { |
105 return fExternalTextureExtensionString; | 131 return fExternalTextureExtensionString; |
106 } | 132 } |
107 | 133 |
| 134 const char* rectangleTextureExtensionString() const { |
| 135 return fRectangleTextureExtensionString; |
| 136 } |
| 137 bool rectangleTextureUseUnifiedTextureFunctionName() const { |
| 138 return fRectangleTextureUseUnifiedTextureFunctionName; |
| 139 } |
108 /** | 140 /** |
109 * Given a texture's config, this determines what swizzle must be appended t
o accesses to the | 141 * Given a texture's config, this determines what swizzle must be appended t
o accesses to the |
110 * texture in generated shader code. Swizzling may be implemented in texture
parameters or a | 142 * texture in generated shader code. Swizzling may be implemented in texture
parameters or a |
111 * sampler rather than in the shader. In this case the returned swizzle will
always be "rgba". | 143 * sampler rather than in the shader. In this case the returned swizzle will
always be "rgba". |
112 */ | 144 */ |
113 const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const { | 145 const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const { |
114 return fConfigTextureSwizzle[config]; | 146 return fConfigTextureSwizzle[config]; |
115 } | 147 } |
116 | 148 |
117 /** Swizzle that should occur on the fragment shader outputs for a given con
fig. */ | 149 /** Swizzle that should occur on the fragment shader outputs for a given con
fig. */ |
(...skipping 17 matching lines...) Expand all Loading... |
135 bool fFBFetchSupport : 1; | 167 bool fFBFetchSupport : 1; |
136 bool fFBFetchNeedsCustomOutput : 1; | 168 bool fFBFetchNeedsCustomOutput : 1; |
137 bool fBindlessTextureSupport : 1; | 169 bool fBindlessTextureSupport : 1; |
138 bool fUsesPrecisionModifiers : 1; | 170 bool fUsesPrecisionModifiers : 1; |
139 bool fCanUseAnyFunctionInShader : 1; | 171 bool fCanUseAnyFunctionInShader : 1; |
140 | 172 |
141 // Used for specific driver bug work arounds | 173 // Used for specific driver bug work arounds |
142 bool fCanUseMinAndAbsTogether : 1; | 174 bool fCanUseMinAndAbsTogether : 1; |
143 bool fMustForceNegatedAtanParamToFloat : 1; | 175 bool fMustForceNegatedAtanParamToFloat : 1; |
144 | 176 |
| 177 bool fRectangleTextureUseUnifiedTextureFunctionName : 1; |
| 178 |
145 const char* fVersionDeclString; | 179 const char* fVersionDeclString; |
146 | 180 |
147 const char* fShaderDerivativeExtensionString; | 181 const char* fShaderDerivativeExtensionString; |
148 const char* fFragCoordConventionsExtensionString; | 182 const char* fFragCoordConventionsExtensionString; |
149 const char* fSecondaryOutputExtensionString; | 183 const char* fSecondaryOutputExtensionString; |
150 const char* fExternalTextureExtensionString; | 184 const char* fExternalTextureExtensionString; |
| 185 const char* fRectangleTextureExtensionString; |
151 | 186 |
152 const char* fFBFetchColorName; | 187 const char* fFBFetchColorName; |
153 const char* fFBFetchExtensionString; | 188 const char* fFBFetchExtensionString; |
154 | 189 |
155 AdvBlendEqInteraction fAdvBlendEqInteraction; | 190 AdvBlendEqInteraction fAdvBlendEqInteraction; |
156 | 191 |
157 GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt]; | 192 GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt]; |
158 GrSwizzle fConfigOutputSwizzle[kGrPixelConfigCnt]; | 193 GrSwizzle fConfigOutputSwizzle[kGrPixelConfigCnt]; |
159 | 194 |
160 friend class GrGLCaps; // For initialization. | 195 friend class GrGLCaps; // For initialization. |
161 friend class GrVkCaps; | 196 friend class GrVkCaps; |
162 | 197 |
163 typedef GrShaderCaps INHERITED; | 198 typedef GrShaderCaps INHERITED; |
164 }; | 199 }; |
165 | 200 |
166 #endif | 201 #endif |
OLD | NEW |