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

Side by Side Diff: src/gpu/GrDrawTarget.cpp

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/GrCoordTransform.cpp ('k') | src/gpu/GrDrawTargetCaps.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 2010 Google Inc. 3 * Copyright 2010 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 8
9 9
10 10
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1039
1040 fMaxRenderTargetSize = other.fMaxRenderTargetSize; 1040 fMaxRenderTargetSize = other.fMaxRenderTargetSize;
1041 fMaxTextureSize = other.fMaxTextureSize; 1041 fMaxTextureSize = other.fMaxTextureSize;
1042 fMaxSampleCount = other.fMaxSampleCount; 1042 fMaxSampleCount = other.fMaxSampleCount;
1043 1043
1044 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende rSupport)); 1044 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende rSupport));
1045 memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTex tureSupport)); 1045 memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTex tureSupport));
1046 1046
1047 fShaderPrecisionVaries = other.fShaderPrecisionVaries; 1047 fShaderPrecisionVaries = other.fShaderPrecisionVaries;
1048 for (int s = 0; s < kGrShaderTypeCount; ++s) { 1048 for (int s = 0; s < kGrShaderTypeCount; ++s) {
1049 for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) { 1049 for (int p = 0; p < kGrSLPrecisionCount; ++p) {
1050 fFloatPrecisions[s][p] = other.fFloatPrecisions[s][p]; 1050 fFloatPrecisions[s][p] = other.fFloatPrecisions[s][p];
1051 } 1051 }
1052 } 1052 }
1053 return *this; 1053 return *this;
1054 } 1054 }
1055 1055
1056 static SkString map_flags_to_string(uint32_t flags) { 1056 static SkString map_flags_to_string(uint32_t flags) {
1057 SkString str; 1057 SkString str;
1058 if (GrDrawTargetCaps::kNone_MapFlags == flags) { 1058 if (GrDrawTargetCaps::kNone_MapFlags == flags) {
1059 str = "none"; 1059 str = "none";
(...skipping 18 matching lines...) Expand all
1078 case kVertex_GrShaderType: 1078 case kVertex_GrShaderType:
1079 return "vertex"; 1079 return "vertex";
1080 case kGeometry_GrShaderType: 1080 case kGeometry_GrShaderType:
1081 return "geometry"; 1081 return "geometry";
1082 case kFragment_GrShaderType: 1082 case kFragment_GrShaderType:
1083 return "fragment"; 1083 return "fragment";
1084 } 1084 }
1085 return ""; 1085 return "";
1086 } 1086 }
1087 1087
1088 static const char* precision_to_string(GrShaderVar::Precision p) { 1088 static const char* precision_to_string(GrSLPrecision p) {
1089 switch (p) { 1089 switch (p) {
1090 case GrShaderVar::kLow_Precision: 1090 case kLow_GrSLPrecision:
1091 return "low"; 1091 return "low";
1092 case GrShaderVar::kMedium_Precision: 1092 case kMedium_GrSLPrecision:
1093 return "medium"; 1093 return "medium";
1094 case GrShaderVar::kHigh_Precision: 1094 case kHigh_GrSLPrecision:
1095 return "high"; 1095 return "high";
1096 } 1096 }
1097 return ""; 1097 return "";
1098 } 1098 }
1099 1099
1100 SkString GrDrawTargetCaps::dump() const { 1100 SkString GrDrawTargetCaps::dump() const {
1101 SkString r; 1101 SkString r;
1102 static const char* gNY[] = {"NO", "YES"}; 1102 static const char* gNY[] = {"NO", "YES"};
1103 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]); 1103 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]);
1104 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileS upport]); 1104 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileS upport]);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 r.appendf("%s is uploadable to a texture: %s\n", 1170 r.appendf("%s is uploadable to a texture: %s\n",
1171 kConfigNames[i], 1171 kConfigNames[i],
1172 gNY[fConfigTextureSupport[i]]); 1172 gNY[fConfigTextureSupport[i]]);
1173 } 1173 }
1174 1174
1175 r.appendf("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVar ies]); 1175 r.appendf("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVar ies]);
1176 1176
1177 for (int s = 0; s < kGrShaderTypeCount; ++s) { 1177 for (int s = 0; s < kGrShaderTypeCount; ++s) {
1178 GrShaderType shaderType = static_cast<GrShaderType>(s); 1178 GrShaderType shaderType = static_cast<GrShaderType>(s);
1179 r.appendf("\t%s:\n", shader_type_to_string(shaderType)); 1179 r.appendf("\t%s:\n", shader_type_to_string(shaderType));
1180 for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) { 1180 for (int p = 0; p < kGrSLPrecisionCount; ++p) {
1181 if (fFloatPrecisions[s][p].supported()) { 1181 if (fFloatPrecisions[s][p].supported()) {
1182 GrShaderVar::Precision precision = static_cast<GrShaderVar::Prec ision>(p); 1182 GrSLPrecision precision = static_cast<GrSLPrecision>(p);
1183 r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n", 1183 r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n",
1184 precision_to_string(precision), 1184 precision_to_string(precision),
1185 fFloatPrecisions[s][p].fLogRangeLow, 1185 fFloatPrecisions[s][p].fLogRangeLow,
1186 fFloatPrecisions[s][p].fLogRangeHigh, 1186 fFloatPrecisions[s][p].fLogRangeHigh,
1187 fFloatPrecisions[s][p].fBits); 1187 fFloatPrecisions[s][p].fBits);
1188 } 1188 }
1189 } 1189 }
1190 } 1190 }
1191 1191
1192 return r; 1192 return r;
(...skipping 15 matching lines...) Expand all
1208 GrDrawState::AutoRestoreStencil* ars, 1208 GrDrawState::AutoRestoreStencil* ars,
1209 GrDrawState* ds, 1209 GrDrawState* ds,
1210 GrClipMaskManager::ScissorState* scissorState) { 1210 GrClipMaskManager::ScissorState* scissorState) {
1211 return fClipMaskManager.setupClipping(ds, 1211 return fClipMaskManager.setupClipping(ds,
1212 are, 1212 are,
1213 ars, 1213 ars,
1214 scissorState, 1214 scissorState,
1215 this->getClip(), 1215 this->getClip(),
1216 devBounds); 1216 devBounds);
1217 } 1217 }
OLDNEW
« no previous file with comments | « src/gpu/GrCoordTransform.cpp ('k') | src/gpu/GrDrawTargetCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698