| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from gpu_tests import test_expectations | 5 from gpu_tests import test_expectations |
| 6 | 6 |
| 7 ANGLE_CONDITIONS = ['d3d9', 'd3d11', 'opengl', 'no_angle'] | 7 ANGLE_CONDITIONS = ['d3d9', 'd3d11', 'opengl', 'no_angle'] |
| 8 | 8 |
| 9 GPU_CONDITIONS = ['amd', 'arm', 'broadcom', 'hisilicon', 'intel', 'imagination', | 9 GPU_CONDITIONS = ['amd', 'arm', 'broadcom', 'hisilicon', 'intel', 'imagination', |
| 10 'nvidia', 'qualcomm', 'vivante'] | 10 'nvidia', 'qualcomm', 'vivante'] |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 Examples: ('nvidia', 0x1234), ('arm', 'Mali-T604') | 36 Examples: ('nvidia', 0x1234), ('arm', 'Mali-T604') |
| 37 Device IDs must be paired with a GPU vendor. | 37 Device IDs must be paired with a GPU vendor. |
| 38 | 38 |
| 39 Sample usage in SetExpectations in subclasses: | 39 Sample usage in SetExpectations in subclasses: |
| 40 self.Fail('gl-enable-vertex-attrib.html', | 40 self.Fail('gl-enable-vertex-attrib.html', |
| 41 ['mac', 'amd', ('nvidia', 0x1234)], bug=123) | 41 ['mac', 'amd', ('nvidia', 0x1234)], bug=123) |
| 42 """ | 42 """ |
| 43 if isinstance(condition, tuple): | 43 if isinstance(condition, tuple): |
| 44 c0 = condition[0].lower() | 44 c0 = condition[0].lower() |
| 45 if c0 in GPU_CONDITIONS: | 45 if c0 in GPU_CONDITIONS: |
| 46 self.device_id_conditions.append((c0, condition[1])) | 46 device = condition[1] |
| 47 if isinstance(device, str): |
| 48 # If the device is parseable as an int, that's not allowed. |
| 49 # It's too easy to make a mistake specifying the device ID |
| 50 # as a string instead of an int. |
| 51 was_int = False |
| 52 try: |
| 53 int(device, 0) |
| 54 was_int = True |
| 55 except Exception: |
| 56 pass |
| 57 if was_int: |
| 58 raise ValueError( |
| 59 'Device id %s should have been specified as an integer' % |
| 60 condition[1]) |
| 61 self.device_id_conditions.append((c0, device)) |
| 47 else: | 62 else: |
| 48 raise ValueError('Unknown expectation condition: "%s"' % c0) | 63 raise ValueError('Unknown expectation condition: "%s"' % c0) |
| 49 else: | 64 else: |
| 50 cl = condition.lower() | 65 cl = condition.lower() |
| 51 if cl in GPU_CONDITIONS: | 66 if cl in GPU_CONDITIONS: |
| 52 self.gpu_conditions.append(cl) | 67 self.gpu_conditions.append(cl) |
| 53 elif cl in ANGLE_CONDITIONS: | 68 elif cl in ANGLE_CONDITIONS: |
| 54 self.angle_conditions.append(cl) | 69 self.angle_conditions.append(cl) |
| 55 else: | 70 else: |
| 56 # Delegate to superclass. | 71 # Delegate to superclass. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if gpu_info and gpu_info.aux_attributes: | 142 if gpu_info and gpu_info.aux_attributes: |
| 128 gl_renderer = gpu_info.aux_attributes.get('gl_renderer') | 143 gl_renderer = gpu_info.aux_attributes.get('gl_renderer') |
| 129 if gl_renderer and 'ANGLE' in gl_renderer: | 144 if gl_renderer and 'ANGLE' in gl_renderer: |
| 130 if 'Direct3D11' in gl_renderer: | 145 if 'Direct3D11' in gl_renderer: |
| 131 return 'd3d11' | 146 return 'd3d11' |
| 132 elif 'Direct3D9' in gl_renderer: | 147 elif 'Direct3D9' in gl_renderer: |
| 133 return 'd3d9' | 148 return 'd3d9' |
| 134 elif 'OpenGL' in gl_renderer: | 149 elif 'OpenGL' in gl_renderer: |
| 135 return 'opengl' | 150 return 'opengl' |
| 136 return 'no_angle' | 151 return 'no_angle' |
| OLD | NEW |