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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 | 1482 |
1482 #endif | 1483 #endif |
1483 | 1484 |
1484 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1"; | 1485 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1"; |
1485 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2"; | 1486 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2"; |
1486 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3"; | 1487 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3"; |
1487 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1"; | 1488 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1"; |
1488 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]"; | 1489 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]"; |
1489 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]"; | 1490 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]"; |
1490 | 1491 |
| 1492 const char* GLES2DecoderTestBase::kOutputVariable1Name = "gl_FragColor"; |
| 1493 const char* GLES2DecoderTestBase::kOutputVariable1NameESSL3 = "color"; |
| 1494 |
1491 void GLES2DecoderTestBase::SetupDefaultProgram() { | 1495 void GLES2DecoderTestBase::SetupDefaultProgram() { |
1492 { | 1496 { |
1493 static AttribInfo attribs[] = { | 1497 static AttribInfo attribs[] = { |
1494 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, | 1498 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, |
1495 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, | 1499 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, |
1496 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, | 1500 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, |
1497 }; | 1501 }; |
1498 static UniformInfo uniforms[] = { | 1502 static UniformInfo uniforms[] = { |
1499 { kUniform1Name, kUniform1Size, kUniform1Type, | 1503 { kUniform1Name, kUniform1Size, kUniform1Type, |
1500 kUniform1FakeLocation, kUniform1RealLocation, | 1504 kUniform1FakeLocation, kUniform1RealLocation, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 attribs, num_attribs, uniforms, | 1619 attribs, num_attribs, uniforms, |
1616 num_uniforms, program_service_id); | 1620 num_uniforms, program_service_id); |
1617 } | 1621 } |
1618 | 1622 |
1619 DoCreateShader( | 1623 DoCreateShader( |
1620 GL_VERTEX_SHADER, vertex_shader_client_id, vertex_shader_service_id); | 1624 GL_VERTEX_SHADER, vertex_shader_client_id, vertex_shader_service_id); |
1621 DoCreateShader( | 1625 DoCreateShader( |
1622 GL_FRAGMENT_SHADER, fragment_shader_client_id, | 1626 GL_FRAGMENT_SHADER, fragment_shader_client_id, |
1623 fragment_shader_service_id); | 1627 fragment_shader_service_id); |
1624 | 1628 |
1625 TestHelper::SetShaderStates( | 1629 TestHelper::SetShaderStates(gl_.get(), GetShader(vertex_shader_client_id), |
1626 gl_.get(), GetShader(vertex_shader_client_id), true); | 1630 true, NULL, NULL, &shader_language_version_, NULL, |
1627 TestHelper::SetShaderStates( | 1631 NULL, NULL, NULL, NULL); |
1628 gl_.get(), GetShader(fragment_shader_client_id), true); | 1632 |
| 1633 AttributeList frag_output_variable_list; |
| 1634 frag_output_variable_list.push_back(TestHelper::ConstructAttribute( |
| 1635 GL_FLOAT_VEC4, 0, GL_MEDIUM_FLOAT, true, |
| 1636 shader_language_version_ == 100 ? kOutputVariable1Name |
| 1637 : kOutputVariable1NameESSL3)); |
| 1638 TestHelper::SetShaderStates(gl_.get(), GetShader(fragment_shader_client_id), |
| 1639 true, NULL, NULL, &shader_language_version_, NULL, |
| 1640 NULL, NULL, &frag_output_variable_list, NULL); |
1629 | 1641 |
1630 cmds::AttachShader attach_cmd; | 1642 cmds::AttachShader attach_cmd; |
1631 attach_cmd.Init(program_client_id, vertex_shader_client_id); | 1643 attach_cmd.Init(program_client_id, vertex_shader_client_id); |
1632 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1644 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
1633 | 1645 |
1634 attach_cmd.Init(program_client_id, fragment_shader_client_id); | 1646 attach_cmd.Init(program_client_id, fragment_shader_client_id); |
1635 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1647 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
1636 | 1648 |
1637 cmds::LinkProgram link_cmd; | 1649 cmds::LinkProgram link_cmd; |
1638 link_cmd.Init(program_client_id); | 1650 link_cmd.Init(program_client_id); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 SetupDefaultProgram(); | 1855 SetupDefaultProgram(); |
1844 } | 1856 } |
1845 | 1857 |
1846 // Include the auto-generated part of this file. We split this because it means | 1858 // Include the auto-generated part of this file. We split this because it means |
1847 // we can easily edit the non-auto generated parts right here in this file | 1859 // we can easily edit the non-auto generated parts right here in this file |
1848 // instead of having to edit some template or the code generator. | 1860 // instead of having to edit some template or the code generator. |
1849 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1861 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
1850 | 1862 |
1851 } // namespace gles2 | 1863 } // namespace gles2 |
1852 } // namespace gpu | 1864 } // namespace gpu |
OLD | NEW |