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

Unified Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 458333003: Work around NVIDIA driver issue with glLineWidth(NaN) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 4 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 | gpu/command_buffer/service/context_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/build_gles2_cmd_buffer.py
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 1216a7f45ae9e4c6f4f4034afa4eeb2e9583f050..aaae2724be098cf1aa2d6c3354b0145a1a380e01 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -425,6 +425,11 @@ _STATES = {
'type': 'GLfloat',
'default': '1.0f',
'range_checks': [{'check': "<= 0.0f", 'test_value': "0.0f"}],
+ # This works around an NVIDIA driver bug, where an INVALID_VALUE error
+ # is generated if line width is set to NaN. The consequences of setting
+ # line width to NaN are undefined, so we just set it to an arbitrary
+ # valid value.
+ 'convert_nan': '1.0f',
}],
},
'DepthMask': {
@@ -3350,6 +3355,11 @@ class StateSetHandler(TypeHandler):
if item.get('cached', False):
file.Write(" state_.%s = %s;\n" %
(CachedStateName(item), args[ndx].name))
+ if 'convert_nan' in item:
+ file.Write(' if (base::IsNaN(%s)) {' % args[ndx].name)
+ file.Write(' %s = %s;' % (args[ndx].name, item['convert_nan']))
+ file.Write(' }\n')
+
file.Write(" %s(%s);\n" %
(func.GetGLFunctionName(), func.MakeOriginalArgString("")))
file.Write(" }\n")
@@ -7612,8 +7622,18 @@ void ContextState::InitState(const ContextState *prev_state) const {
file.Write("(%s != prev_state->%s)" %
(item_name, item_name))
if test_prev:
- file.Write(" )\n")
+ file.Write(" ) {\n")
+ for place, item in enumerate(state['states']):
+ if 'convert_nan' in item:
+ item_name = CachedStateName(item)
+ args[place] = 'sanitized_%s' % item_name
+ file.Write(' %s %s = %s;' %
+ (item['type'], args[place], item_name))
+ file.Write(' if (base::IsNaN(%s))' % item_name)
+ file.Write(' %s = %s;' % (args[place], item['convert_nan']))
file.Write(" gl%s(%s);\n" % (state['func'], ", ".join(args)))
+ if test_prev:
+ file.Write(" }\n")
file.Write(" if (prev_state) {")
WriteStates(True)
« no previous file with comments | « no previous file | gpu/command_buffer/service/context_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698