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

Side by Side Diff: src/gpu/GrDrawTargetCaps.h

Issue 777443003: Move shader precision out of GrShaderVar (Closed) Base URL: https://skia.googlesource.com/skia.git@prec
Patch Set: rebase Created 6 years 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 | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('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 GrDrawTargetCaps_DEFINED 8 #ifndef GrDrawTargetCaps_DEFINED
9 #define GrDrawTargetCaps_DEFINED 9 #define GrDrawTargetCaps_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "GrTypesPriv.h" 12 #include "GrTypesPriv.h"
13 #include "GrShaderVar.h" 13 #include "GrShaderVar.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 #include "SkString.h" 15 #include "SkString.h"
16 16
17 /** 17 /**
18 * Represents the draw target capabilities. 18 * Represents the draw target capabilities.
19 */ 19 */
20 class GrDrawTargetCaps : public SkRefCnt { 20 class GrDrawTargetCaps : public SkRefCnt {
21 public: 21 public:
22 SK_DECLARE_INST_COUNT(GrDrawTargetCaps) 22 SK_DECLARE_INST_COUNT(GrDrawTargetCaps)
23 23
24 /** Info about shader variable precision within a given shader stage. That i s, this info 24 /** Info about shader variable precision within a given shader stage. That i s, this info
25 is relevant to a float (or vecNf) variable declared with a GrShaderVar:: Precision 25 is relevant to a float (or vecNf) variable declared with a GrSLPrecision
26 in a given GrShaderType. The info here is hoisted from the OpenGL spec. */ 26 in a given GrShaderType. The info here is hoisted from the OpenGL spec. */
27 struct PrecisionInfo { 27 struct PrecisionInfo {
28 PrecisionInfo() { 28 PrecisionInfo() {
29 fLogRangeLow = 0; 29 fLogRangeLow = 0;
30 fLogRangeHigh = 0; 30 fLogRangeHigh = 0;
31 fBits = 0; 31 fBits = 0;
32 } 32 }
33 33
34 /** Is this precision level allowed in the shader stage? */ 34 /** Is this precision level allowed in the shader stage? */
35 bool supported() const { return 0 != fBits; } 35 bool supported() const { return 0 != fBits; }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return fConfigTextureSupport[config]; 120 return fConfigTextureSupport[config];
121 } 121 }
122 122
123 /** 123 /**
124 * Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrS LType, etc in a 124 * Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrS LType, etc in a
125 * given shader type. If the shader type is not supported or the precision l evel is not 125 * given shader type. If the shader type is not supported or the precision l evel is not
126 * supported in that shader type then the returned struct will report false when supported() is 126 * supported in that shader type then the returned struct will report false when supported() is
127 * called. 127 * called.
128 */ 128 */
129 const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType, 129 const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType,
130 GrShaderVar::Precision prec ision) const { 130 GrSLPrecision precision) co nst {
131 return fFloatPrecisions[shaderType][precision]; 131 return fFloatPrecisions[shaderType][precision];
132 }; 132 };
133 133
134 /** 134 /**
135 * Is there any difference between the float shader variable precision types ? If this is true 135 * Is there any difference between the float shader variable precision types ? If this is true
136 * then unless the shader type is not supported, any call to getFloatShaderP recisionInfo() would 136 * then unless the shader type is not supported, any call to getFloatShaderP recisionInfo() would
137 * report the same info for all precisions in all shader types. 137 * report the same info for all precisions in all shader types.
138 */ 138 */
139 bool floatPrecisionVaries() const { return fShaderPrecisionVaries; } 139 bool floatPrecisionVaries() const { return fShaderPrecisionVaries; }
140 140
(...skipping 27 matching lines...) Expand all
168 168
169 int fMaxRenderTargetSize; 169 int fMaxRenderTargetSize;
170 int fMaxTextureSize; 170 int fMaxTextureSize;
171 int fMaxSampleCount; 171 int fMaxSampleCount;
172 172
173 // The first entry for each config is without msaa and the second is with. 173 // The first entry for each config is without msaa and the second is with.
174 bool fConfigRenderSupport[kGrPixelConfigCnt][2]; 174 bool fConfigRenderSupport[kGrPixelConfigCnt][2];
175 bool fConfigTextureSupport[kGrPixelConfigCnt]; 175 bool fConfigTextureSupport[kGrPixelConfigCnt];
176 176
177 bool fShaderPrecisionVaries; 177 bool fShaderPrecisionVaries;
178 PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][GrShaderVar::kPrecisionCo unt]; 178 PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount];
179 179
180 private: 180 private:
181 static uint32_t CreateUniqueID(); 181 static uint32_t CreateUniqueID();
182 182
183 const uint32_t fUniqueID; 183 const uint32_t fUniqueID;
184 184
185 typedef SkRefCnt INHERITED; 185 typedef SkRefCnt INHERITED;
186 }; 186 };
187 187
188 #endif 188 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698