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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 778783002: Use texture size to determine precision of texture coord varyings (Closed) Base URL: https://skia.googlesource.com/skia.git@defaultp
Patch Set: include skrandom.h in new gm cpp 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrCoordTransform.cpp ('k') | src/gpu/GrDrawTargetCaps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 65764b88cecf4858335da81f8434df235a0a4fa2..ed54bf9514ae201ccc13e10919e1f852ccc3956f 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -1011,6 +1011,8 @@ void GrDrawTargetCaps::reset() {
fMaxTextureSize = 0;
fMaxSampleCount = 0;
+ fShaderPrecisionVaries = false;
+
memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport));
memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport));
}
@@ -1042,6 +1044,12 @@ GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRenderSupport));
memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTextureSupport));
+ fShaderPrecisionVaries = other.fShaderPrecisionVaries;
+ for (int s = 0; s < kGrShaderTypeCount; ++s) {
+ for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) {
+ fFloatPrecisions[s][p] = other.fFloatPrecisions[s][p];
+ }
+ }
return *this;
}
@@ -1065,6 +1073,30 @@ static SkString map_flags_to_string(uint32_t flags) {
return str;
}
+static const char* shader_type_to_string(GrShaderType type) {
+ switch (type) {
+ case kVertex_GrShaderType:
+ return "vertex";
+ case kGeometry_GrShaderType:
+ return "geometry";
+ case kFragment_GrShaderType:
+ return "fragment";
+ }
+ return "";
+}
+
+static const char* precision_to_string(GrShaderVar::Precision p) {
+ switch (p) {
+ case GrShaderVar::kLow_Precision:
+ return "low";
+ case GrShaderVar::kMedium_Precision:
+ return "medium";
+ case GrShaderVar::kHigh_Precision:
+ return "high";
+ }
+ return "";
+}
+
SkString GrDrawTargetCaps::dump() const {
SkString r;
static const char* gNY[] = {"NO", "YES"};
@@ -1140,6 +1172,23 @@ SkString GrDrawTargetCaps::dump() const {
gNY[fConfigTextureSupport[i]]);
}
+ r.appendf("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVaries]);
+
+ for (int s = 0; s < kGrShaderTypeCount; ++s) {
+ GrShaderType shaderType = static_cast<GrShaderType>(s);
+ r.appendf("\t%s:\n", shader_type_to_string(shaderType));
+ for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) {
+ if (fFloatPrecisions[s][p].supported()) {
+ GrShaderVar::Precision precision = static_cast<GrShaderVar::Precision>(p);
+ r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n",
+ precision_to_string(precision),
+ fFloatPrecisions[s][p].fLogRangeLow,
+ fFloatPrecisions[s][p].fLogRangeHigh,
+ fFloatPrecisions[s][p].fBits);
+ }
+ }
+ }
+
return r;
}
« 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