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 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 */ | 155 */ |
156 const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const { | 156 const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const { |
157 return fConfigTextureSwizzle[config]; | 157 return fConfigTextureSwizzle[config]; |
158 } | 158 } |
159 | 159 |
160 /** Swizzle that should occur on the fragment shader outputs for a given con
fig. */ | 160 /** Swizzle that should occur on the fragment shader outputs for a given con
fig. */ |
161 const GrSwizzle& configOutputSwizzle(GrPixelConfig config) const { | 161 const GrSwizzle& configOutputSwizzle(GrPixelConfig config) const { |
162 return fConfigOutputSwizzle[config]; | 162 return fConfigOutputSwizzle[config]; |
163 } | 163 } |
164 | 164 |
| 165 /** Precision qualifier that should be used with a sampler, given its config
and visibility. */ |
| 166 GrSLPrecision samplerPrecision(GrPixelConfig config, GrShaderFlags visibilit
y) const { |
| 167 return static_cast<GrSLPrecision>(fSamplerPrecisions[visibility][config]
); |
| 168 } |
| 169 |
165 GrGLSLGeneration generation() const { return fGLSLGeneration; } | 170 GrGLSLGeneration generation() const { return fGLSLGeneration; } |
166 | 171 |
167 /** | 172 /** |
168 * Returns a string containing the caps info. | 173 * Returns a string containing the caps info. |
169 */ | 174 */ |
170 SkString dump() const override; | 175 SkString dump() const override; |
171 | 176 |
172 private: | 177 private: |
| 178 /** GrCaps subclasses must call this after filling in the shader precision t
able. */ |
| 179 void initSamplerPrecisionTable(); |
| 180 |
173 void onApplyOptionsOverrides(const GrContextOptions& options) override; | 181 void onApplyOptionsOverrides(const GrContextOptions& options) override; |
174 | 182 |
175 GrGLSLGeneration fGLSLGeneration; | 183 GrGLSLGeneration fGLSLGeneration; |
176 | 184 |
177 bool fDropsTileOnZeroDivide : 1; | 185 bool fDropsTileOnZeroDivide : 1; |
178 bool fFBFetchSupport : 1; | 186 bool fFBFetchSupport : 1; |
179 bool fFBFetchNeedsCustomOutput : 1; | 187 bool fFBFetchNeedsCustomOutput : 1; |
180 bool fBindlessTextureSupport : 1; | 188 bool fBindlessTextureSupport : 1; |
181 bool fUsesPrecisionModifiers : 1; | 189 bool fUsesPrecisionModifiers : 1; |
182 bool fCanUseAnyFunctionInShader : 1; | 190 bool fCanUseAnyFunctionInShader : 1; |
(...skipping 26 matching lines...) Expand all Loading... |
209 uint8_t fMaxVertexSamplers; | 217 uint8_t fMaxVertexSamplers; |
210 uint8_t fMaxGeometrySamplers; | 218 uint8_t fMaxGeometrySamplers; |
211 uint8_t fMaxFragmentSamplers; | 219 uint8_t fMaxFragmentSamplers; |
212 uint8_t fMaxCombinedSamplers; | 220 uint8_t fMaxCombinedSamplers; |
213 | 221 |
214 AdvBlendEqInteraction fAdvBlendEqInteraction; | 222 AdvBlendEqInteraction fAdvBlendEqInteraction; |
215 | 223 |
216 GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt]; | 224 GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt]; |
217 GrSwizzle fConfigOutputSwizzle[kGrPixelConfigCnt]; | 225 GrSwizzle fConfigOutputSwizzle[kGrPixelConfigCnt]; |
218 | 226 |
| 227 uint8_t fSamplerPrecisions[(1 << kGrShaderTypeCount)][kGrPixelConfigCnt]; |
| 228 |
219 friend class GrGLCaps; // For initialization. | 229 friend class GrGLCaps; // For initialization. |
220 friend class GrVkCaps; | 230 friend class GrVkCaps; |
221 | 231 |
222 typedef GrShaderCaps INHERITED; | 232 typedef GrShaderCaps INHERITED; |
223 }; | 233 }; |
224 | 234 |
225 #endif | 235 #endif |
OLD | NEW |