| 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)
|
|
|