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

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

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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #include "GrCaps.h" 8 #include "GrCaps.h"
9 #include "GrContextOptions.h" 9 #include "GrContextOptions.h"
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 GrSLPrecision precision = static_cast<GrSLPrecision>(p); 62 GrSLPrecision precision = static_cast<GrSLPrecision>(p);
63 r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n", 63 r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n",
64 precision_to_string(precision), 64 precision_to_string(precision),
65 fFloatPrecisions[s][p].fLogRangeLow, 65 fFloatPrecisions[s][p].fLogRangeLow,
66 fFloatPrecisions[s][p].fLogRangeHigh, 66 fFloatPrecisions[s][p].fLogRangeHigh,
67 fFloatPrecisions[s][p].fBits); 67 fFloatPrecisions[s][p].fBits);
68 } 68 }
69 } 69 }
70 } 70 }
71 71
72 r.append("Effective Float Precisions:\n");
73
74 for (int s = 0; s < kGrShaderTypeCount; ++s) {
75 GrShaderType shaderType = static_cast<GrShaderType>(s);
76 r.appendf("\t%s: ", shader_type_to_string(shaderType));
77 for (int p = kGrSLPrecisionCount - 1 ; p >= 0; --p) {
78 GrSLPrecision precision = static_cast<GrSLPrecision>(p);
79 r.appendf("%s=%s", precision_to_string(precision),
80 precision_to_string(fEffectiveFloatPrecisions[s][p]));
81 r.append(p + 1 < kGrSLPrecisionCount ? " " : "\n");
82 }
83 }
84
72 return r; 85 return r;
73 } 86 }
74 87
88 void GrShaderCaps::initEffectiveFloatPrecisionTable() {
89 for (int s = 0; s < kGrShaderTypeCount; ++s) {
90 const PrecisionInfo* info = fFloatPrecisions[s];
91 GrSLPrecision* p = fEffectiveFloatPrecisions[s];
92 p[kHigh_GrSLPrecision] = kHigh_GrSLPrecision;
93 p[kMedium_GrSLPrecision] = info[kHigh_GrSLPrecision] == info[kMedium_GrS LPrecision] ?
94 kHigh_GrSLPrecision : kMedium_GrSLPrecisi on;
95 p[kLow_GrSLPrecision] = info[kMedium_GrSLPrecision] == info[kLow_GrSLPre cision] ?
96 p[kMedium_GrSLPrecision] : kLow_GrSLPrecisio n;
97 }
98 }
99
75 void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) { 100 void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) {
76 fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppres sDualSourceBlending; 101 fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppres sDualSourceBlending;
77 this->onApplyOptionsOverrides(options); 102 this->onApplyOptionsOverrides(options);
78 } 103 }
79 104
80 /////////////////////////////////////////////////////////////////////////////// 105 ///////////////////////////////////////////////////////////////////////////////
81 106
82 GrCaps::GrCaps(const GrContextOptions& options) { 107 GrCaps::GrCaps(const GrContextOptions& options) {
83 fMipMapSupport = false; 108 fMipMapSupport = false;
84 fNPOTTextureTileSupport = false; 109 fNPOTTextureTileSupport = false;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 281
257 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { 282 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) {
258 GrPixelConfig config = static_cast<GrPixelConfig>(i); 283 GrPixelConfig config = static_cast<GrPixelConfig>(i);
259 r.appendf("%s is uploadable to a texture: %s\n", 284 r.appendf("%s is uploadable to a texture: %s\n",
260 kConfigNames[i], 285 kConfigNames[i],
261 gNY[this->isConfigTexturable(config)]); 286 gNY[this->isConfigTexturable(config)]);
262 } 287 }
263 288
264 return r; 289 return r;
265 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698