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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 16409014: gpu: Workaround invalid values from GetShaderPrecisionFormat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 2363e5346ee01712513a0217ae6e0ece0652a12c..bf217f67e0bb2bfa879b2c1a3bf604450852e564 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -120,6 +120,22 @@ static void GetShaderPrecisionFormatImpl(GLenum shader_type,
// platforms.
glGetShaderPrecisionFormat(shader_type, precision_type,
range, precision);
+
+ // Some drivers have bugs where they report the ranges as a negative number.
+ // Taking the absolute value here shouldn't hurt because negative numbers
+ // aren't expected anyway.
+ range[0] = abs(range[0]);
+ range[1] = abs(range[1]);
+
+ // If the driver reports a precision for highp float that isn't actually
+ // highp, don't pretend like it's supported because shader compilation will
+ // fail anyway.
+ if (precision_type == GL_HIGH_FLOAT &&
+ (range[0] < 62 || range[1] < 62 || *precision < 16)) {
Ken Russell (switch to Gerrit) 2013/06/11 20:01:27 Can the duplicate logic here and in GLES2DecoderIm
brianderson 2013/06/11 23:35:46 Done.
+ range[0] = 0;
+ range[1] = 0;
+ *precision = 0;
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698