Chromium Code Reviews| 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 ea859c91515fade60a84027c7711003a3543b508..63a2fe58a923e3847e8e8e33d19b8d8ae8ce738c 100755 |
| --- a/gpu/command_buffer/build_gles2_cmd_buffer.py |
| +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py |
| @@ -414,6 +414,62 @@ _STATES = { |
| 'type': 'GLint', |
| 'enum': 'GL_UNPACK_ALIGNMENT', |
| 'default': '4' |
| + }, |
| + { |
| + 'name': 'pack_row_length', |
| + 'type': 'GLint', |
| + 'enum': 'GL_PACK_ROW_LENGTH', |
| + 'default': '0', |
| + 'es3': True |
| + }, |
| + { |
| + 'name': 'pack_skip_pixels', |
| + 'type': 'GLint', |
| + 'enum': 'GL_PACK_SKIP_PIXELS', |
| + 'default': '0', |
| + 'es3': True |
| + }, |
| + { |
| + 'name': 'pack_skip_rows', |
| + 'type': 'GLint', |
| + 'enum': 'GL_PACK_SKIP_ROWS', |
| + 'default': '0', |
| + 'es3': True |
| + }, |
| + { |
| + 'name': 'unpack_row_length', |
| + 'type': 'GLint', |
| + 'enum': 'GL_UNPACK_ROW_LENGTH', |
| + 'default': '0', |
| + 'es3': True |
| + }, |
| + { |
| + 'name': 'unpack_image_height', |
| + 'type': 'GLint', |
| + 'enum': 'GL_UNPACK_IMAGE_HEIGHT', |
| + 'default': '0', |
| + 'es3': True |
| + }, |
| + { |
| + 'name': 'unpack_skip_pixels', |
| + 'type': 'GLint', |
| + 'enum': 'GL_UNPACK_SKIP_PIXELS', |
| + 'default': '0', |
| + 'es3': True |
| + }, |
| + { |
| + 'name': 'unpack_skip_rows', |
| + 'type': 'GLint', |
| + 'enum': 'GL_UNPACK_SKIP_ROWS', |
| + 'default': '0', |
| + 'es3': True |
| + }, |
| + { |
| + 'name': 'unpack_skip_images', |
| + 'type': 'GLint', |
| + 'enum': 'GL_UNPACK_SKIP_IMAGES', |
| + 'default': '0', |
| + 'es3': True |
| } |
| ], |
| }, |
| @@ -10184,6 +10240,9 @@ void ContextState::InitState(const ContextState *prev_state) const { |
| for item in state['states']: |
| item_name = CachedStateName(item) |
| + if 'es3' in item: |
| + assert item['es3'] |
| + f.write(" if (feature_info_->IsES3Enabled()) {\n"); |
|
Ken Russell (switch to Gerrit)
2015/11/25 00:59:41
This needs to be IsES3Capable() because we may swi
Zhenyao Mo
2015/11/25 18:18:48
Done.
|
| if 'extension_flag' in item: |
| f.write(" if (feature_info_->feature_flags().%s) {\n " % |
| item['extension_flag']) |
| @@ -10209,7 +10268,7 @@ void ContextState::InitState(const ContextState *prev_state) const { |
| (item['enum_set'] |
| if 'enum_set' in item else item['enum']), |
| item['name'])) |
| - if 'gl_version_flag' in item: |
| + if 'gl_version_flag' in item or 'es3' in item: |
| f.write(" }\n") |
| if test_prev: |
| if 'extension_flag' in item: |
| @@ -10406,7 +10465,7 @@ bool GLES2DecoderImpl::SetCapabilityState(GLenum cap, bool enabled) { |
| f.write(""" } |
| } |
| -void GLES2DecoderTestBase::SetupInitStateExpectations() { |
| +void GLES2DecoderTestBase::SetupInitStateExpectations(bool es3_capable) { |
| """) |
| # We need to sort the keys so the expectations match |
| for state_name in sorted(_STATES.keys()): |
| @@ -10431,6 +10490,10 @@ void GLES2DecoderTestBase::SetupInitStateExpectations() { |
| f.write(" if (group_->feature_info()->feature_flags().%s) {\n" % |
| item['extension_flag']) |
| f.write(" ") |
| + if 'es3' in item: |
| + assert item['es3'] |
| + f.write(" if (es3_capable) {\n") |
| + f.write(" ") |
| expect_value = item['default'] |
| if isinstance(expect_value, list): |
| # TODO: Currently we do not check array values. |
| @@ -10444,7 +10507,7 @@ void GLES2DecoderTestBase::SetupInitStateExpectations() { |
| expect_value)) |
| f.write(" .Times(1)\n") |
| f.write(" .RetiresOnSaturation();\n") |
| - if 'extension_flag' in item: |
| + if 'extension_flag' in item or 'es3' in item: |
| f.write(" }\n") |
| else: |
| if 'extension_flag' in state: |
| @@ -10779,7 +10842,9 @@ const size_t GLES2Util::enum_to_string_table_len_ = |
| enum) |
| valid_list = _NAMED_TYPE_INFO[enum]['valid'] |
| if 'valid_es3' in _NAMED_TYPE_INFO[enum]: |
| - valid_list = valid_list + _NAMED_TYPE_INFO[enum]['valid_es3'] |
| + for es3_enum in _NAMED_TYPE_INFO[enum]['valid_es3']: |
| + if not es3_enum in valid_list: |
| + valid_list.append(es3_enum) |
| assert len(valid_list) == len(set(valid_list)) |
| if len(valid_list) > 0: |
| f.write(" static const EnumToString string_table[] = {\n") |
| @@ -11020,6 +11085,7 @@ def main(argv): |
| # Add in states and capabilites to GLState |
| gl_state_valid = _NAMED_TYPE_INFO['GLState']['valid'] |
| + gl_state_valid_es3 = _NAMED_TYPE_INFO['GLState']['valid_es3'] |
| for state_name in sorted(_STATES.keys()): |
| state = _STATES[state_name] |
| if 'extension_flag' in state: |
| @@ -11031,8 +11097,13 @@ def main(argv): |
| for item in state['states']: |
| if 'extension_flag' in item: |
| continue |
| - if not item['enum'] in gl_state_valid: |
| - gl_state_valid.append(item['enum']) |
| + if 'es3' in item: |
| + assert item['es3'] |
| + if not item['enum'] in gl_state_valid_es3: |
| + gl_state_valid_es3.append(item['enum']) |
| + else: |
| + if not item['enum'] in gl_state_valid: |
| + gl_state_valid.append(item['enum']) |
| for capability in _CAPABILITY_FLAGS: |
| valid_value = "GL_%s" % capability['name'].upper() |
| if not valid_value in gl_state_valid: |