Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: include/gpu/GrCaps.h

Issue 1846963004: Infer sampler precision from pixel config (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase, create dependency chain Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/gpu/GrTextureAccess.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef GrCaps_DEFINED 8 #ifndef GrCaps_DEFINED
9 #define GrCaps_DEFINED 9 #define GrCaps_DEFINED
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 * given shader type. If the shader type is not supported or the precision le vel is not 69 * given shader type. If the shader type is not supported or the precision le vel is not
70 * supported in that shader type then the returned struct will report false w hen supported() is 70 * supported in that shader type then the returned struct will report false w hen supported() is
71 * called. 71 * called.
72 */ 72 */
73 const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType, 73 const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType,
74 GrSLPrecision precision) co nst { 74 GrSLPrecision precision) co nst {
75 return fFloatPrecisions[shaderType][precision]; 75 return fFloatPrecisions[shaderType][precision];
76 }; 76 };
77 77
78 /** 78 /**
79 * Returns the effective amount of precision found in floating point types wi th a given precision
80 * qualifier.
81 *
82 * e.g. If lowp == mediump, effectiveFloatPrecision(lowp) is mediump.
83 * If the platform doesn't use precision, effectiveFloatPrecision() is always highp.
84 */
85 GrSLPrecision effectiveFloatPrecision(GrShaderType shaderType, GrSLPrecision precision) const {
bsalomon 2016/04/06 13:35:56 It still feels odd to me that we have a precooked
86 return fEffectiveFloatPrecisions[shaderType][precision];
87 }
88
89 /**
79 * Is there any difference between the float shader variable precision types? If this is true 90 * Is there any difference between the float shader variable precision types? If this is true
80 * then unless the shader type is not supported, any call to getFloatShaderPr ecisionInfo() would 91 * then unless the shader type is not supported, any call to getFloatShaderPr ecisionInfo() would
81 * report the same info for all precisions in all shader types. 92 * report the same info for all precisions in all shader types.
82 */ 93 */
83 bool floatPrecisionVaries() const { return fShaderPrecisionVaries; } 94 bool floatPrecisionVaries() const { return fShaderPrecisionVaries; }
84 95
85 /** 96 /**
86 * PLS storage size in bytes (0 when not supported). The PLS spec defines a minimum size of 16 97 * PLS storage size in bytes (0 when not supported). The PLS spec defines a minimum size of 16
87 * bytes whenever PLS is supported. 98 * bytes whenever PLS is supported.
88 */ 99 */
89 int pixelLocalStorageSize() const { return fPixelLocalStorageSize; } 100 int pixelLocalStorageSize() const { return fPixelLocalStorageSize; }
90 101
91 /** 102 /**
92 * True if this context supports the necessary extensions and features to en able the PLS path 103 * True if this context supports the necessary extensions and features to en able the PLS path
93 * renderer. 104 * renderer.
94 */ 105 */
95 bool plsPathRenderingSupport() const { 106 bool plsPathRenderingSupport() const {
96 #if GR_ENABLE_PLS_PATH_RENDERING 107 #if GR_ENABLE_PLS_PATH_RENDERING
97 return fPLSPathRenderingSupport; 108 return fPLSPathRenderingSupport;
98 #else 109 #else
99 return false; 110 return false;
100 #endif 111 #endif
101 } 112 }
102 113
103 protected: 114 protected:
115 /** Subclasses must call this after filling in the shader precision table. * /
116 void initEffectiveFloatPrecisionTable();
117
104 /** Subclasses must call this after initialization in order to apply caps ov errides requested by 118 /** Subclasses must call this after initialization in order to apply caps ov errides requested by
105 the client. Note that overrides will only reduce the caps never expand t hem. */ 119 the client. Note that overrides will only reduce the caps never expand t hem. */
106 void applyOptionsOverrides(const GrContextOptions& options); 120 void applyOptionsOverrides(const GrContextOptions& options);
107 121
108 bool fShaderDerivativeSupport : 1; 122 bool fShaderDerivativeSupport : 1;
109 bool fGeometryShaderSupport : 1; 123 bool fGeometryShaderSupport : 1;
110 bool fPathRenderingSupport : 1; 124 bool fPathRenderingSupport : 1;
111 bool fDstReadInShaderSupport : 1; 125 bool fDstReadInShaderSupport : 1;
112 bool fDualSourceBlendingSupport : 1; 126 bool fDualSourceBlendingSupport : 1;
113 bool fIntegerSupport : 1; 127 bool fIntegerSupport : 1;
114 128
115 bool fShaderPrecisionVaries; 129 bool fShaderPrecisionVaries;
116 PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount]; 130 PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount];
131 GrSLPrecision fEffectiveFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCo unt];
117 int fPixelLocalStorageSize; 132 int fPixelLocalStorageSize;
118 bool fPLSPathRenderingSupport; 133 bool fPLSPathRenderingSupport;
119 134
120 private: 135 private:
121 virtual void onApplyOptionsOverrides(const GrContextOptions&) {}; 136 virtual void onApplyOptionsOverrides(const GrContextOptions&) {};
122 typedef SkRefCnt INHERITED; 137 typedef SkRefCnt INHERITED;
123 }; 138 };
124 139
125 /** 140 /**
126 * Represents the capabilities of a GrContext. 141 * Represents the capabilities of a GrContext.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 virtual void onApplyOptionsOverrides(const GrContextOptions&) {}; 341 virtual void onApplyOptionsOverrides(const GrContextOptions&) {};
327 342
328 bool fSuppressPrints : 1; 343 bool fSuppressPrints : 1;
329 bool fImmediateFlush: 1; 344 bool fImmediateFlush: 1;
330 bool fDrawPathMasksToCompressedTextureSupport : 1; 345 bool fDrawPathMasksToCompressedTextureSupport : 1;
331 346
332 typedef SkRefCnt INHERITED; 347 typedef SkRefCnt INHERITED;
333 }; 348 };
334 349
335 #endif 350 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrTextureAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698