OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 client_sync_id_(127), | 112 client_sync_id_(127), |
113 service_renderbuffer_id_(0), | 113 service_renderbuffer_id_(0), |
114 service_renderbuffer_valid_(false), | 114 service_renderbuffer_valid_(false), |
115 ignore_cached_state_for_test_(GetParam()), | 115 ignore_cached_state_for_test_(GetParam()), |
116 cached_color_mask_red_(true), | 116 cached_color_mask_red_(true), |
117 cached_color_mask_green_(true), | 117 cached_color_mask_green_(true), |
118 cached_color_mask_blue_(true), | 118 cached_color_mask_blue_(true), |
119 cached_color_mask_alpha_(true), | 119 cached_color_mask_alpha_(true), |
120 cached_depth_mask_(true), | 120 cached_depth_mask_(true), |
121 cached_stencil_front_mask_(static_cast<GLuint>(-1)), | 121 cached_stencil_front_mask_(static_cast<GLuint>(-1)), |
122 cached_stencil_back_mask_(static_cast<GLuint>(-1)) { | 122 cached_stencil_back_mask_(static_cast<GLuint>(-1)), |
| 123 shader_language_version_(100) { |
123 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); | 124 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); |
124 } | 125 } |
125 | 126 |
126 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} | 127 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} |
127 | 128 |
128 void GLES2DecoderTestBase::SetUp() { | 129 void GLES2DecoderTestBase::SetUp() { |
129 InitState init; | 130 InitState init; |
130 // Autogenerated tests do not overwrite version or extension string, | 131 // Autogenerated tests do not overwrite version or extension string, |
131 // so we have to pick something that supports everything here. | 132 // so we have to pick something that supports everything here. |
132 init.gl_version = "4.4"; | 133 init.gl_version = "4.4"; |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 | 1464 |
1464 #endif | 1465 #endif |
1465 | 1466 |
1466 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1"; | 1467 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1"; |
1467 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2"; | 1468 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2"; |
1468 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3"; | 1469 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3"; |
1469 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1"; | 1470 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1"; |
1470 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]"; | 1471 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]"; |
1471 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]"; | 1472 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]"; |
1472 | 1473 |
| 1474 const char* GLES2DecoderTestBase::kOutputVariable1Name = "gl_FragColor"; |
| 1475 const char* GLES2DecoderTestBase::kOutputVariable1NameESSL3 = "color"; |
| 1476 |
1473 void GLES2DecoderTestBase::SetupDefaultProgram() { | 1477 void GLES2DecoderTestBase::SetupDefaultProgram() { |
1474 { | 1478 { |
1475 static AttribInfo attribs[] = { | 1479 static AttribInfo attribs[] = { |
1476 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, | 1480 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, |
1477 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, | 1481 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, |
1478 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, | 1482 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, |
1479 }; | 1483 }; |
1480 static UniformInfo uniforms[] = { | 1484 static UniformInfo uniforms[] = { |
1481 { kUniform1Name, kUniform1Size, kUniform1Type, | 1485 { kUniform1Name, kUniform1Size, kUniform1Type, |
1482 kUniform1FakeLocation, kUniform1RealLocation, | 1486 kUniform1FakeLocation, kUniform1RealLocation, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 attribs, num_attribs, uniforms, | 1601 attribs, num_attribs, uniforms, |
1598 num_uniforms, program_service_id); | 1602 num_uniforms, program_service_id); |
1599 } | 1603 } |
1600 | 1604 |
1601 DoCreateShader( | 1605 DoCreateShader( |
1602 GL_VERTEX_SHADER, vertex_shader_client_id, vertex_shader_service_id); | 1606 GL_VERTEX_SHADER, vertex_shader_client_id, vertex_shader_service_id); |
1603 DoCreateShader( | 1607 DoCreateShader( |
1604 GL_FRAGMENT_SHADER, fragment_shader_client_id, | 1608 GL_FRAGMENT_SHADER, fragment_shader_client_id, |
1605 fragment_shader_service_id); | 1609 fragment_shader_service_id); |
1606 | 1610 |
1607 TestHelper::SetShaderStates( | 1611 TestHelper::SetShaderStates(gl_.get(), GetShader(vertex_shader_client_id), |
1608 gl_.get(), GetShader(vertex_shader_client_id), true); | 1612 true, nullptr, nullptr, &shader_language_version_, |
1609 TestHelper::SetShaderStates( | 1613 nullptr, nullptr, nullptr, nullptr, nullptr); |
1610 gl_.get(), GetShader(fragment_shader_client_id), true); | 1614 |
| 1615 AttributeList frag_output_variable_list; |
| 1616 frag_output_variable_list.push_back(TestHelper::ConstructAttribute( |
| 1617 GL_FLOAT_VEC4, 0, GL_MEDIUM_FLOAT, true, |
| 1618 shader_language_version_ == 100 ? kOutputVariable1Name |
| 1619 : kOutputVariable1NameESSL3)); |
| 1620 TestHelper::SetShaderStates(gl_.get(), GetShader(fragment_shader_client_id), |
| 1621 true, nullptr, nullptr, &shader_language_version_, |
| 1622 nullptr, nullptr, nullptr, |
| 1623 &frag_output_variable_list, nullptr); |
1611 | 1624 |
1612 cmds::AttachShader attach_cmd; | 1625 cmds::AttachShader attach_cmd; |
1613 attach_cmd.Init(program_client_id, vertex_shader_client_id); | 1626 attach_cmd.Init(program_client_id, vertex_shader_client_id); |
1614 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1627 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
1615 | 1628 |
1616 attach_cmd.Init(program_client_id, fragment_shader_client_id); | 1629 attach_cmd.Init(program_client_id, fragment_shader_client_id); |
1617 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1630 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
1618 | 1631 |
1619 cmds::LinkProgram link_cmd; | 1632 cmds::LinkProgram link_cmd; |
1620 link_cmd.Init(program_client_id); | 1633 link_cmd.Init(program_client_id); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 SetupDefaultProgram(); | 1838 SetupDefaultProgram(); |
1826 } | 1839 } |
1827 | 1840 |
1828 // Include the auto-generated part of this file. We split this because it means | 1841 // Include the auto-generated part of this file. We split this because it means |
1829 // we can easily edit the non-auto generated parts right here in this file | 1842 // we can easily edit the non-auto generated parts right here in this file |
1830 // instead of having to edit some template or the code generator. | 1843 // instead of having to edit some template or the code generator. |
1831 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1844 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
1832 | 1845 |
1833 } // namespace gles2 | 1846 } // namespace gles2 |
1834 } // namespace gpu | 1847 } // namespace gpu |
OLD | NEW |