| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 client_sync_id_(127), | 113 client_sync_id_(127), |
| 114 service_renderbuffer_id_(0), | 114 service_renderbuffer_id_(0), |
| 115 service_renderbuffer_valid_(false), | 115 service_renderbuffer_valid_(false), |
| 116 ignore_cached_state_for_test_(GetParam()), | 116 ignore_cached_state_for_test_(GetParam()), |
| 117 cached_color_mask_red_(true), | 117 cached_color_mask_red_(true), |
| 118 cached_color_mask_green_(true), | 118 cached_color_mask_green_(true), |
| 119 cached_color_mask_blue_(true), | 119 cached_color_mask_blue_(true), |
| 120 cached_color_mask_alpha_(true), | 120 cached_color_mask_alpha_(true), |
| 121 cached_depth_mask_(true), | 121 cached_depth_mask_(true), |
| 122 cached_stencil_front_mask_(static_cast<GLuint>(-1)), | 122 cached_stencil_front_mask_(static_cast<GLuint>(-1)), |
| 123 cached_stencil_back_mask_(static_cast<GLuint>(-1)) { | 123 cached_stencil_back_mask_(static_cast<GLuint>(-1)), |
| 124 shader_language_version_(100) { |
| 124 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); | 125 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); |
| 125 } | 126 } |
| 126 | 127 |
| 127 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} | 128 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} |
| 128 | 129 |
| 129 void GLES2DecoderTestBase::SetUp() { | 130 void GLES2DecoderTestBase::SetUp() { |
| 130 InitState init; | 131 InitState init; |
| 131 // Autogenerated tests do not overwrite version or extension string, | 132 // Autogenerated tests do not overwrite version or extension string, |
| 132 // so we have to pick something that supports everything here. | 133 // so we have to pick something that supports everything here. |
| 133 init.gl_version = "4.4"; | 134 init.gl_version = "4.4"; |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 const GLenum GLES2DecoderTestBase::kUniform1Type; | 1486 const GLenum GLES2DecoderTestBase::kUniform1Type; |
| 1486 const GLenum GLES2DecoderTestBase::kUniform2Type; | 1487 const GLenum GLES2DecoderTestBase::kUniform2Type; |
| 1487 const GLenum GLES2DecoderTestBase::kUniform3Type; | 1488 const GLenum GLES2DecoderTestBase::kUniform3Type; |
| 1488 const GLenum GLES2DecoderTestBase::kUniform4Type; | 1489 const GLenum GLES2DecoderTestBase::kUniform4Type; |
| 1489 const GLenum GLES2DecoderTestBase::kUniform5Type; | 1490 const GLenum GLES2DecoderTestBase::kUniform5Type; |
| 1490 const GLenum GLES2DecoderTestBase::kUniform6Type; | 1491 const GLenum GLES2DecoderTestBase::kUniform6Type; |
| 1491 const GLenum GLES2DecoderTestBase::kUniform7Type; | 1492 const GLenum GLES2DecoderTestBase::kUniform7Type; |
| 1492 const GLenum GLES2DecoderTestBase::kUniformCubemapType; | 1493 const GLenum GLES2DecoderTestBase::kUniformCubemapType; |
| 1493 const GLint GLES2DecoderTestBase::kInvalidUniformLocation; | 1494 const GLint GLES2DecoderTestBase::kInvalidUniformLocation; |
| 1494 const GLint GLES2DecoderTestBase::kBadUniformIndex; | 1495 const GLint GLES2DecoderTestBase::kBadUniformIndex; |
| 1495 | 1496 const GLint GLES2DecoderTestBase::kOutputVariable1Size; |
| 1497 const GLenum GLES2DecoderTestBase::kOutputVariable1Type; |
| 1498 const GLuint GLES2DecoderTestBase::kOutputVariable1ColorName; |
| 1499 const GLuint GLES2DecoderTestBase::kOutputVariable1Index; |
| 1496 #endif | 1500 #endif |
| 1497 | 1501 |
| 1498 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1"; | 1502 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1"; |
| 1499 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2"; | 1503 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2"; |
| 1500 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3"; | 1504 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3"; |
| 1501 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1"; | 1505 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1"; |
| 1502 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]"; | 1506 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]"; |
| 1503 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]"; | 1507 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]"; |
| 1504 const char* GLES2DecoderTestBase::kUniform4Name = "uniform4"; | 1508 const char* GLES2DecoderTestBase::kUniform4Name = "uniform4"; |
| 1505 const char* GLES2DecoderTestBase::kUniform5Name = "uniform5"; | 1509 const char* GLES2DecoderTestBase::kUniform5Name = "uniform5"; |
| 1506 const char* GLES2DecoderTestBase::kUniform6Name = "uniform6"; | 1510 const char* GLES2DecoderTestBase::kUniform6Name = "uniform6"; |
| 1507 const char* GLES2DecoderTestBase::kUniform7Name = "uniform7"; | 1511 const char* GLES2DecoderTestBase::kUniform7Name = "uniform7"; |
| 1508 | 1512 |
| 1513 const char* GLES2DecoderTestBase::kOutputVariable1Name = "gl_FragColor"; |
| 1514 const char* GLES2DecoderTestBase::kOutputVariable1NameESSL3 = "color"; |
| 1515 |
| 1509 void GLES2DecoderTestBase::SetupDefaultProgram() { | 1516 void GLES2DecoderTestBase::SetupDefaultProgram() { |
| 1510 { | 1517 { |
| 1511 static AttribInfo attribs[] = { | 1518 static AttribInfo attribs[] = { |
| 1512 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, | 1519 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, |
| 1513 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, | 1520 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, |
| 1514 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, | 1521 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, |
| 1515 }; | 1522 }; |
| 1516 static UniformInfo uniforms[] = { | 1523 static UniformInfo uniforms[] = { |
| 1517 { kUniform1Name, kUniform1Size, kUniform1Type, | 1524 { kUniform1Name, kUniform1Size, kUniform1Type, |
| 1518 kUniform1FakeLocation, kUniform1RealLocation, | 1525 kUniform1FakeLocation, kUniform1RealLocation, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 void GLES2DecoderWithShaderTestBase::TearDown() { | 1654 void GLES2DecoderWithShaderTestBase::TearDown() { |
| 1648 GLES2DecoderTestBase::TearDown(); | 1655 GLES2DecoderTestBase::TearDown(); |
| 1649 } | 1656 } |
| 1650 | 1657 |
| 1651 void GLES2DecoderTestBase::SetupShader( | 1658 void GLES2DecoderTestBase::SetupShader( |
| 1652 GLES2DecoderTestBase::AttribInfo* attribs, size_t num_attribs, | 1659 GLES2DecoderTestBase::AttribInfo* attribs, size_t num_attribs, |
| 1653 GLES2DecoderTestBase::UniformInfo* uniforms, size_t num_uniforms, | 1660 GLES2DecoderTestBase::UniformInfo* uniforms, size_t num_uniforms, |
| 1654 GLuint program_client_id, GLuint program_service_id, | 1661 GLuint program_client_id, GLuint program_service_id, |
| 1655 GLuint vertex_shader_client_id, GLuint vertex_shader_service_id, | 1662 GLuint vertex_shader_client_id, GLuint vertex_shader_service_id, |
| 1656 GLuint fragment_shader_client_id, GLuint fragment_shader_service_id) { | 1663 GLuint fragment_shader_client_id, GLuint fragment_shader_service_id) { |
| 1664 static TestHelper::ProgramOutputInfo kProgramOutputsESSL1[] = {{ |
| 1665 kOutputVariable1Name, kOutputVariable1Size, kOutputVariable1Type, |
| 1666 kOutputVariable1ColorName, kOutputVariable1Index, |
| 1667 }}; |
| 1668 static TestHelper::ProgramOutputInfo kProgramOutputsESSL3[] = {{ |
| 1669 kOutputVariable1NameESSL3, kOutputVariable1Size, kOutputVariable1Type, |
| 1670 kOutputVariable1ColorName, kOutputVariable1Index, |
| 1671 }}; |
| 1672 TestHelper::ProgramOutputInfo* program_outputs = |
| 1673 shader_language_version_ == 100 ? kProgramOutputsESSL1 |
| 1674 : kProgramOutputsESSL3; |
| 1675 const size_t kNumProgramOutputs = 1; |
| 1676 |
| 1657 { | 1677 { |
| 1658 InSequence s; | 1678 InSequence s; |
| 1659 | 1679 |
| 1660 EXPECT_CALL(*gl_, | 1680 EXPECT_CALL(*gl_, |
| 1661 AttachShader(program_service_id, vertex_shader_service_id)) | 1681 AttachShader(program_service_id, vertex_shader_service_id)) |
| 1662 .Times(1) | 1682 .Times(1) |
| 1663 .RetiresOnSaturation(); | 1683 .RetiresOnSaturation(); |
| 1664 EXPECT_CALL(*gl_, | 1684 EXPECT_CALL(*gl_, |
| 1665 AttachShader(program_service_id, fragment_shader_service_id)) | 1685 AttachShader(program_service_id, fragment_shader_service_id)) |
| 1666 .Times(1) | 1686 .Times(1) |
| 1667 .RetiresOnSaturation(); | 1687 .RetiresOnSaturation(); |
| 1668 TestHelper::SetupShaderExpectations(gl_.get(), group_->feature_info(), | 1688 |
| 1669 attribs, num_attribs, uniforms, | 1689 TestHelper::SetupShaderExpectationsWithVaryings( |
| 1670 num_uniforms, program_service_id); | 1690 gl_.get(), group_->feature_info(), attribs, num_attribs, uniforms, |
| 1691 num_uniforms, nullptr, 0, program_outputs, kNumProgramOutputs, |
| 1692 program_service_id); |
| 1671 } | 1693 } |
| 1672 | 1694 |
| 1673 DoCreateShader( | 1695 DoCreateShader( |
| 1674 GL_VERTEX_SHADER, vertex_shader_client_id, vertex_shader_service_id); | 1696 GL_VERTEX_SHADER, vertex_shader_client_id, vertex_shader_service_id); |
| 1675 DoCreateShader( | 1697 DoCreateShader( |
| 1676 GL_FRAGMENT_SHADER, fragment_shader_client_id, | 1698 GL_FRAGMENT_SHADER, fragment_shader_client_id, |
| 1677 fragment_shader_service_id); | 1699 fragment_shader_service_id); |
| 1678 | 1700 |
| 1679 TestHelper::SetShaderStates( | 1701 TestHelper::SetShaderStates(gl_.get(), GetShader(vertex_shader_client_id), |
| 1680 gl_.get(), GetShader(vertex_shader_client_id), true); | 1702 true, nullptr, nullptr, &shader_language_version_, |
| 1681 TestHelper::SetShaderStates( | 1703 nullptr, nullptr, nullptr, nullptr, nullptr); |
| 1682 gl_.get(), GetShader(fragment_shader_client_id), true); | 1704 |
| 1705 OutputVariableList frag_output_variable_list; |
| 1706 frag_output_variable_list.push_back(TestHelper::ConstructOutputVariable( |
| 1707 program_outputs[0].type, program_outputs[0].size, GL_MEDIUM_FLOAT, true, |
| 1708 program_outputs[0].name)); |
| 1709 |
| 1710 TestHelper::SetShaderStates(gl_.get(), GetShader(fragment_shader_client_id), |
| 1711 true, nullptr, nullptr, &shader_language_version_, |
| 1712 nullptr, nullptr, nullptr, |
| 1713 &frag_output_variable_list, nullptr); |
| 1683 | 1714 |
| 1684 cmds::AttachShader attach_cmd; | 1715 cmds::AttachShader attach_cmd; |
| 1685 attach_cmd.Init(program_client_id, vertex_shader_client_id); | 1716 attach_cmd.Init(program_client_id, vertex_shader_client_id); |
| 1686 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1717 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
| 1687 | 1718 |
| 1688 attach_cmd.Init(program_client_id, fragment_shader_client_id); | 1719 attach_cmd.Init(program_client_id, fragment_shader_client_id); |
| 1689 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1720 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
| 1690 | 1721 |
| 1691 cmds::LinkProgram link_cmd; | 1722 cmds::LinkProgram link_cmd; |
| 1692 link_cmd.Init(program_client_id); | 1723 link_cmd.Init(program_client_id); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 SetupDefaultProgram(); | 1928 SetupDefaultProgram(); |
| 1898 } | 1929 } |
| 1899 | 1930 |
| 1900 // Include the auto-generated part of this file. We split this because it means | 1931 // Include the auto-generated part of this file. We split this because it means |
| 1901 // we can easily edit the non-auto generated parts right here in this file | 1932 // we can easily edit the non-auto generated parts right here in this file |
| 1902 // instead of having to edit some template or the code generator. | 1933 // instead of having to edit some template or the code generator. |
| 1903 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1934 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
| 1904 | 1935 |
| 1905 } // namespace gles2 | 1936 } // namespace gles2 |
| 1906 } // namespace gpu | 1937 } // namespace gpu |
| OLD | NEW |