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

Unified Diff: cc/output/shader.cc

Issue 14705008: cc: Cache highp_threshold in TexCoordPrecisionRequired (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use local cache rather than global cache to avoid thread hazards. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/shader.h ('k') | cc/output/shader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/shader.cc
diff --git a/cc/output/shader.cc b/cc/output/shader.cc
index 2226192d9af9a6840e64be959452c9df71154193..e3862567388949b54949fb0b3543e5a3f7f6f3d0 100644
--- a/cc/output/shader.cc
+++ b/cc/output/shader.cc
@@ -79,19 +79,23 @@ static std::string SetVertexTexCoordPrecision(const char* shader_string) {
}
TexCoordPrecision TexCoordPrecisionRequired(WebGraphicsContext3D* context,
+ int *highp_threshold_cache,
int highp_threshold_min,
int x, int y) {
- // Initialize range and precision with minimum spec values for when
- // GetShaderPrecisionFormat is a test stub.
- // TODO(brianderson): Implement better stubs of GetShaderPrecisionFormat
- // everywhere.
- GLint range[2] = { 14, 14 };
- GLint precision = 10;
- GLC(context, context->getShaderPrecisionFormat(GL_FRAGMENT_SHADER,
- GL_MEDIUM_FLOAT,
- range, &precision));
- int highp_threshold = std::max(1 << precision, highp_threshold_min);
- if (x > highp_threshold || y > highp_threshold)
+ if (*highp_threshold_cache == 0) {
vangelis 2013/05/03 22:08:33 I think you'll need to add: || *highp_threashold_
+ // Initialize range and precision with minimum spec values for when
+ // GetShaderPrecisionFormat is a test stub.
+ // TODO(brianderson): Implement better stubs of GetShaderPrecisionFormat
+ // everywhere.
+ static GLint range[2] = { 14, 14 };
+ static GLint precision = 10;
vangelis 2013/05/03 22:08:33 Do these need to be static?
+ GLC(context, context->getShaderPrecisionFormat(GL_FRAGMENT_SHADER,
+ GL_MEDIUM_FLOAT,
+ range, &precision));
+ *highp_threshold_cache = std::max(1 << precision, highp_threshold_min);
+ }
+
+ if (x > *highp_threshold_cache || y > *highp_threshold_cache)
return TexCoordPrecisionHigh;
return TexCoordPrecisionMedium;
}
@@ -99,16 +103,20 @@ TexCoordPrecision TexCoordPrecisionRequired(WebGraphicsContext3D* context,
} // namespace
TexCoordPrecision TexCoordPrecisionRequired(WebGraphicsContext3D* context,
+ int *highp_threshold_cache,
int highp_threshold_min,
gfx::Point max_coordinate) {
- return TexCoordPrecisionRequired(context, highp_threshold_min,
+ return TexCoordPrecisionRequired(context,
+ highp_threshold_cache, highp_threshold_min,
max_coordinate.x(), max_coordinate.y());
}
TexCoordPrecision TexCoordPrecisionRequired(WebGraphicsContext3D* context,
+ int *highp_threshold_cache,
int highp_threshold_min,
gfx::Size max_size) {
- return TexCoordPrecisionRequired(context, highp_threshold_min,
+ return TexCoordPrecisionRequired(context,
+ highp_threshold_cache, highp_threshold_min,
max_size.width(), max_size.height());
}
« no previous file with comments | « cc/output/shader.h ('k') | cc/output/shader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698