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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 13004003: gpu: Cache results of GetShaderPrecisionFormat client-side (Closed) Base URL: http://git.chromium.org/chromium/src.git@shp3
Patch Set: re-upload Created 7 years, 9 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
Index: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 0da78bcf19e1b95aa67024383ddda891e37e9eb4..958882357c95e3da3a836f52d202451a6aff6137 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -1941,10 +1941,20 @@ void GLES2Implementation::GetShaderPrecisionFormat(
if (!result) {
return;
}
- result->success = false;
- helper_->GetShaderPrecisionFormat(
- shadertype, precisiontype, GetResultShmId(), GetResultShmOffset());
- WaitForCmd();
+
+ ShaderPrecisionCacheKey key(shadertype, precisiontype);
+ ShaderPrecisionCacheMap::iterator i = shader_precision_cache_.find(key);
+ if (i != shader_precision_cache_.end()) {
+ *result = i->second;
+ } else {
+ result->success = false;
+ helper_->GetShaderPrecisionFormat(
+ shadertype, precisiontype, GetResultShmId(), GetResultShmOffset());
+ WaitForCmd();
+ if (result->success)
+ shader_precision_cache_[key] = *result;
+ }
+
if (result->success) {
if (range) {
range[0] = result->min_range;

Powered by Google App Engine
This is Rietveld 408576698